From 7dca1f3ac764c88f235c61d3270622bcab2869b6 Mon Sep 17 00:00:00 2001 From: Alex Lyman Date: Thu, 23 Nov 2017 12:09:01 -0800 Subject: [PATCH 1/2] Add type definitions for the loadware package --- types/loadware/index.d.ts | 16 ++++++++++++++++ types/loadware/loadware-tests.ts | 20 ++++++++++++++++++++ types/loadware/tsconfig.json | 23 +++++++++++++++++++++++ types/loadware/tslint.json | 1 + 4 files changed, 60 insertions(+) create mode 100644 types/loadware/index.d.ts create mode 100644 types/loadware/loadware-tests.ts create mode 100644 types/loadware/tsconfig.json create mode 100644 types/loadware/tslint.json diff --git a/types/loadware/index.d.ts b/types/loadware/index.d.ts new file mode 100644 index 0000000000..dc3f13437c --- /dev/null +++ b/types/loadware/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for loadware 2.0.0 +// Project: https://github.com/franciscop/loadware +// Definitions by: A.J.J. Lyman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// tslint:disable-next-line:ban-types +type AnyFunction = Function; + +declare function loadware(...loadable: Array>): ReadonlyArray; + +declare namespace loadware { + type Loadable = string | F | RecursiveLoadable; + interface RecursiveLoadable extends Array> { } +} + +export = loadware; diff --git a/types/loadware/loadware-tests.ts b/types/loadware/loadware-tests.ts new file mode 100644 index 0000000000..630d3fd351 --- /dev/null +++ b/types/loadware/loadware-tests.ts @@ -0,0 +1,20 @@ +import loadware = require("loadware"); + +interface Context { __ContextMarker: never; } +interface Response { __ResponseMarker: never; } +type Middleware = (ctx: Context) => void; + +loadware( + (_: Context) => {}, + [ + (_: Context) => {}, + 'loadware/requires-strings' + ], + [ + [ + [ + (_: Context) => {} + ] + ] + ] +); diff --git a/types/loadware/tsconfig.json b/types/loadware/tsconfig.json new file mode 100644 index 0000000000..5921615bf8 --- /dev/null +++ b/types/loadware/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/types/loadware/tslint.json b/types/loadware/tslint.json new file mode 100644 index 0000000000..c17ac4dd6d --- /dev/null +++ b/types/loadware/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dtslint.json" } From 00121a0418878414f9b1510725e4031c418f8b2b Mon Sep 17 00:00:00 2001 From: Alex Lyman Date: Thu, 23 Nov 2017 18:56:17 -0800 Subject: [PATCH 2/2] Fix linting failure. Weird, when I run lint locally, it demands that I have the tslint.json derived from "dtslint/dtslint.json" but Travis CI apparently disagrees and wants "dtslint/dt.json". --- types/loadware/index.d.ts | 2 +- types/loadware/tslint.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/loadware/index.d.ts b/types/loadware/index.d.ts index dc3f13437c..7c45225d44 100644 --- a/types/loadware/index.d.ts +++ b/types/loadware/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for loadware 2.0.0 +// Type definitions for loadware 2.0 // Project: https://github.com/franciscop/loadware // Definitions by: A.J.J. Lyman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/loadware/tslint.json b/types/loadware/tslint.json index c17ac4dd6d..6746359dda 100644 --- a/types/loadware/tslint.json +++ b/types/loadware/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dtslint.json" } +{ + "extends": "dtslint/dt.json" +}