mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
Add @koa/cors based on kcors (#20310)
This commit is contained in:
committed by
Masahiro Wakame
parent
01a5cf5820
commit
bb0de78f73
24
types/koa__cors/index.d.ts
vendored
Normal file
24
types/koa__cors/index.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Type definitions for @koa/cors 2.2
|
||||
// Project: https://github.com/koajs/cors
|
||||
// Definitions by: Xavier Stouder <https://github.com/Xstoudi>, Izayoi Ko <https://github.com/izayoiko>, Steve Hipwell <https://github.com/stevehipwell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import * as Koa from "koa";
|
||||
|
||||
export = cors;
|
||||
|
||||
declare function cors(options?: cors.Options): Koa.Middleware;
|
||||
|
||||
declare namespace cors {
|
||||
interface Options {
|
||||
origin?: ((req: Koa.Request) => string) | string;
|
||||
allowMethods?: string[] | string;
|
||||
exposeHeaders?: string[] | string;
|
||||
allowHeaders?: string[] | string;
|
||||
maxAge?: number | string;
|
||||
credentials?: boolean;
|
||||
keepHeadersOnError?: boolean;
|
||||
}
|
||||
}
|
||||
5
types/koa__cors/koa__cors-tests.ts
Normal file
5
types/koa__cors/koa__cors-tests.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import Koa = require('koa');
|
||||
import cors = require('@koa/cors');
|
||||
|
||||
const app = new Koa();
|
||||
app.use(cors());
|
||||
25
types/koa__cors/tsconfig.json
Normal file
25
types/koa__cors/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths":{
|
||||
"@koa/cors": ["koa__cors"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"koa__cors-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/koa__cors/tslint.json
Normal file
1
types/koa__cors/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user