mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-18 12:14:39 +08:00
Merge pull request #21713 from ALyman/loadware
Add type definitions for the loadware package
This commit is contained in:
16
types/loadware/index.d.ts
vendored
Normal file
16
types/loadware/index.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for loadware 2.0
|
||||
// Project: https://github.com/franciscop/loadware
|
||||
// Definitions by: A.J.J. Lyman <https://github.com/ALyman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// tslint:disable-next-line:ban-types
|
||||
type AnyFunction = Function;
|
||||
|
||||
declare function loadware<F extends AnyFunction>(...loadable: Array<loadware.Loadable<F>>): ReadonlyArray<F>;
|
||||
|
||||
declare namespace loadware {
|
||||
type Loadable<F extends AnyFunction> = string | F | RecursiveLoadable<F>;
|
||||
interface RecursiveLoadable<F extends AnyFunction> extends Array<F | Loadable<F>> { }
|
||||
}
|
||||
|
||||
export = loadware;
|
||||
20
types/loadware/loadware-tests.ts
Normal file
20
types/loadware/loadware-tests.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import loadware = require("loadware");
|
||||
|
||||
interface Context { __ContextMarker: never; }
|
||||
interface Response { __ResponseMarker: never; }
|
||||
type Middleware = (ctx: Context) => void;
|
||||
|
||||
loadware<Middleware>(
|
||||
(_: Context) => {},
|
||||
[
|
||||
(_: Context) => {},
|
||||
'loadware/requires-strings'
|
||||
],
|
||||
[
|
||||
[
|
||||
[
|
||||
(_: Context) => {}
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
23
types/loadware/tsconfig.json
Normal file
23
types/loadware/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",
|
||||
"loadware-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/loadware/tslint.json
Normal file
3
types/loadware/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user