Skip to content

Commit

Permalink
Add right type definitions to package (#19)
Browse files Browse the repository at this point in the history
Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>
  • Loading branch information
floatdrop and peterblazejewicz committed Jan 16, 2022
1 parent 7f5e4bb commit 106d7e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"type": "module",
"exports": "./index.js",
"types": "./types.d.ts",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
Expand All @@ -26,14 +27,15 @@
"request",
"id",
"uuid"
],
],
"dependencies": {
"uuid": "^8.3.2"
},
"devDependencies": {
"ava": "^3.15.0",
"xo": "^0.46.3",
"express": "^4.17.2",
"supertest": "^6.2.1"
"express-serve-static-core": "^0.1.1",
"supertest": "^6.2.1",
"xo": "^0.46.3"
}
}
12 changes: 12 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express from 'express';
import {Request, RequestHandler} from 'express-serve-static-core';

declare global {
namespace Express {
Expand All @@ -8,3 +9,14 @@ declare global {
}
}
}

declare namespace expressRequestId {
interface Options {
setHeader?: boolean | undefined;
headerName?: string | undefined;
generator?: ((request: Request) => string) | undefined;
}
}

declare function expressRequestId(options?: expressRequestId.Options): RequestHandler;
export = expressRequestId;

0 comments on commit 106d7e1

Please sign in to comment.