Adds type definitions for 'express-request-id' (#36411)

Adds type definitions and tests
Adds tsconfig and tslint config
This commit is contained in:
jgeth
2019-06-27 16:54:16 -07:00
committed by Benjamin Lichtman
parent 21e404a440
commit 12edf9c921
4 changed files with 55 additions and 0 deletions
@@ -0,0 +1,12 @@
import * as expressRequestId from 'express-request-id';
const options: expressRequestId.Options = {
uuidVersion: 'v4',
setHeader: false,
headerName: 'X-Request-Id',
attributeName: 'id',
};
expressRequestId();
expressRequestId({});
expressRequestId(options);
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for express-request-id 1.4
// Project: https://github.com/floatdrop/express-request-id
// Definitions by: jgeth <https://github.com/jgeth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { RequestHandler } from 'express-serve-static-core';
declare namespace expressRequestId {
interface Options {
uuidVersion?: string;
setHeader?: boolean;
headerName?: string;
attributeName?: string;
}
}
declare function expressRequestId(options?: expressRequestId.Options): RequestHandler;
export = expressRequestId;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-request-id-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }