mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
drafted types for concat-map
This commit is contained in:
parent
d1610f6ded
commit
f25c84d1a1
@ -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]
|
||||
12
types/concat-map/index.d.ts
vendored
12
types/concat-map/index.d.ts
vendored
@ -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[];
|
||||
|
||||
@ -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"]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user