mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 08:58:23 +08:00
Add express-to-koa definition (#23153)
* Add express-to-koa definition * Fix types
This commit is contained in:
12
types/express-to-koa/express-to-koa-tests.ts
Normal file
12
types/express-to-koa/express-to-koa-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as Koa from 'koa';
|
||||
import * as connect from 'connect';
|
||||
import expressToKoa = require('express-to-koa');
|
||||
|
||||
const app = new Koa();
|
||||
const middleware: connect.NextHandleFunction = (req, res, next) => {
|
||||
// 'express middleware'
|
||||
next();
|
||||
};
|
||||
|
||||
app.use(expressToKoa(middleware));
|
||||
app.listen(3000);
|
||||
18
types/express-to-koa/index.d.ts
vendored
Normal file
18
types/express-to-koa/index.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Type definitions for express-to-koa 1.0
|
||||
// Project: https://github.com/kaelzhang/express-to-koa
|
||||
// Definitions by: Xiaohan Zhang <https://github.com/xiaohanzhang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Koa from "koa";
|
||||
import { IncomingMessage, ServerResponse } from "http";
|
||||
|
||||
export = expressToKoa;
|
||||
|
||||
declare function expressToKoa(
|
||||
middleware: (
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
next: (err?: any) => void,
|
||||
) => void
|
||||
): Koa.Middleware;
|
||||
23
types/express-to-koa/tsconfig.json
Normal file
23
types/express-to-koa/tsconfig.json
Normal 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",
|
||||
"express-to-koa-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/express-to-koa/tslint.json
Normal file
1
types/express-to-koa/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user