Merge pull request #28478 from danwbyrne/koa-convert

adds typings for the 'koa-convert' package
This commit is contained in:
Armando Aguirre
2018-08-29 15:47:02 -07:00
committed by GitHub
4 changed files with 51 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for koa-convert 1.2
// Project: https://github.com/koajs/convert
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Context, Middleware } from "koa";
declare function convert(
mw: (context: Context, next: () => void) => Generator
): Middleware;
export = convert;
+16
View File
@@ -0,0 +1,16 @@
import convert = require('koa-convert');
import Koa = require('koa');
const app = new Koa();
app.use(modernMiddleware);
app.use(convert(legacyMiddleware));
function * legacyMiddleware(next: any) {
yield next;
}
function modernMiddleware(ctx: Koa.Context, next: any) {
return next().then(() => {});
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"koa-convert-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}