Skip to content

Commit f0b3578

Browse files
committedJun 5, 2024
Include TS declaration
- Add npm script to regenerate types - Include index.d.ts in package
1 parent 064e0e2 commit f0b3578

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed
 

‎index.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export = expressAsyncErrors;
2+
/**
3+
* Applies async errors patch for Express. This should be called before building `express()`.
4+
*
5+
* Usage:
6+
* ```
7+
* import express from 'express';
8+
* import expressAsyncErrors from '@csnw/express-async-errors';
9+
* expressAsyncErrors();
10+
* const app = express();
11+
* ```
12+
*/
13+
declare function expressAsyncErrors(): void;

‎package-lock.json

+16-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
"description": "Async/await error handling support for expressjs",
55
"main": "index.js",
66
"files": [
7-
"index.js"
7+
"index.js",
8+
"index.d.ts"
89
],
910
"scripts": {
1011
"coverage": "nyc mocha test.js",
1112
"report": "nyc report --reporter=html",
13+
"update-types": "tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir .",
1214
"test": "mocha test.js",
1315
"lint": "eslint .",
1416
"precommit": "npm run lint"
@@ -38,6 +40,7 @@
3840
"husky": "^9.0.11",
3941
"mocha": "^10.4.0",
4042
"nyc": "^15.1.0",
41-
"supertest": "^7.0.0"
43+
"supertest": "^7.0.0",
44+
"typescript": "^5.4.5"
4245
}
4346
}

0 commit comments

Comments
 (0)
Please sign in to comment.