mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge pull request #22123 from wanganjun/master
add types for express-promise-router 2.0
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import Router = require("express-promise-router");
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
// equivalent to calling next()
|
||||
return Promise.resolve('next');
|
||||
});
|
||||
|
||||
router.post("/", async (req, res) => {
|
||||
// ...
|
||||
});
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for express-promise-router 2.0
|
||||
// Project: https://github.com/express-promise-router/express-promise-router
|
||||
// Definitions by: Anjun Wang <https://github.com/wanganjun>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/* =================== USAGE ===================
|
||||
import Router = require('express-promise-router');
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get('/', (req, res) => {
|
||||
// equivalent to calling next()
|
||||
return Promise.resolve('next');
|
||||
})
|
||||
|
||||
router.post('/', async (req, res) => {
|
||||
// ...
|
||||
})
|
||||
|
||||
export default router;
|
||||
=============================================== */
|
||||
|
||||
import { Router } from "express";
|
||||
|
||||
/**
|
||||
* A simple wrapper for Express 4's Router that allows middleware to return
|
||||
* promises. If the promise is rejected, `express-promise-router` will call next
|
||||
* with the reason
|
||||
*/
|
||||
declare const PromiseRouter: typeof Router;
|
||||
export = PromiseRouter;
|
||||
@@ -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",
|
||||
"express-promise-router-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user