drafted types for concat-map

This commit is contained in:
Claas Ahlrichs 2019-04-14 14:36:45 +02:00
parent d1610f6ded
commit f25c84d1a1
3 changed files with 17 additions and 20 deletions

View File

@ -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]

View File

@ -1,15 +1,9 @@
// Type definitions for concat-map 0.0
// Project: https://github.com/substack/node-concat-map
// Definitions by: My Self <https://github.com/me>
// Definitions by: Claas Ahlrichs <https://github.com/claasahl>
// 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<T, R>(xs: T[], fn: (x: T) => R | R[]): R[];

View File

@ -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"]
}