diff --git a/types/concat-map/concat-map-tests.ts b/types/concat-map/concat-map-tests.ts index e69de29bb2..9d99d221de 100644 --- a/types/concat-map/concat-map-tests.ts +++ b/types/concat-map/concat-map-tests.ts @@ -0,0 +1,8 @@ +import concatMap from "concat-map"; + +const xs = [1, 2, 3, 4, 5, 6]; +concatMap(xs, x => (x % 2 ? [x - 0.1, x, x + 0.1] : [])); +// [0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1] + +concatMap(xs, x => x % 2); +// [1, 0, 1, 0, 1, 0] diff --git a/types/concat-map/index.d.ts b/types/concat-map/index.d.ts index 4348c625a8..3e874a3449 100644 --- a/types/concat-map/index.d.ts +++ b/types/concat-map/index.d.ts @@ -1,15 +1,9 @@ // Type definitions for concat-map 0.0 // Project: https://github.com/substack/node-concat-map -// Definitions by: My Self +// Definitions by: Claas Ahlrichs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 export = concat_map; -declare function concat_map(xs: any, fn: any): any; - -declare namespace concat_map { - const prototype: { - }; - -} - +declare function concat_map(xs: T[], fn: (x: T) => R | R[]): R[]; diff --git a/types/concat-map/tsconfig.json b/types/concat-map/tsconfig.json index 8e84083a1f..5b6dcf9c5c 100644 --- a/types/concat-map/tsconfig.json +++ b/types/concat-map/tsconfig.json @@ -1,22 +1,17 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, - "files": [ - "index.d.ts", - "concat-map-tests.ts" - ] + "files": ["index.d.ts", "concat-map-tests.ts"] }