mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #28478 from danwbyrne/koa-convert
adds typings for the 'koa-convert' package
This commit is contained in:
Vendored
+13
@@ -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;
|
||||
@@ -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(() => {});
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user