Add typings for the existing connect-datadog package (#29439)

This commit is contained in:
Moshe Good 2018-10-04 13:38:27 -04:00 committed by Wesley Wigham
parent 7f9b4c98a1
commit 8d3d0fab16
4 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,16 @@
import connectDD = require('connect-datadog');
import dogstatsd = require('node-dogstatsd');
// works with no options
const middleware = connectDD({});
// works with all options
const middleware2 = connectDD({
stat: 'foo',
path: true,
method: true,
protocol: true,
response_code: true,
tags: ['abc', 'def'],
dogstatsd: new dogstatsd.StatsD('localhost'),
});

24
types/connect-datadog/index.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
// Type definitions for connect-datadog 0.0
// Project: https://github.com/AppPress/node-connect-datadog
// Definitions by: Moshe Good <https://github.com/moshegood>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import express = require('express');
import dogstatsd = require('node-dogstatsd');
export = Factory;
declare function Factory(options?: Factory.Options): express.RequestHandler;
declare namespace Factory {
interface Options {
stat?: string;
tags?: string[];
path?: boolean;
method?: boolean;
protocol?: boolean;
response_code?: boolean;
dogstatsd?: dogstatsd.StatsD;
}
}

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"connect-datadog-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }