mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Move all packages to a types directory
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
const numberToNumber = (a: number): number => a + 2;
|
||||
const numberToString = (a: number): string => "foo";
|
||||
const stringToNumber = (a: string): number => 5;
|
||||
|
||||
import composeFunction = require("compose-function");
|
||||
const t1: number = composeFunction(numberToNumber, numberToNumber)(5);
|
||||
const t2: string = composeFunction(numberToString, numberToNumber)(5);
|
||||
const t3: string = composeFunction(numberToString, stringToNumber)("f");
|
||||
const t4: (a: string) => number = composeFunction(
|
||||
(f: (a: string) => number) => ((p: string): number => 5),
|
||||
(f: (a: number) => string) => ((p: string) => 4)
|
||||
)(numberToString);
|
||||
|
||||
|
||||
const t5: number = composeFunction(stringToNumber, numberToString, numberToNumber)(5);
|
||||
const t6: string = composeFunction(numberToString, stringToNumber, numberToString, numberToNumber)(5);
|
||||
|
||||
const t7: string = composeFunction<string>(
|
||||
numberToString, numberToNumber, stringToNumber, numberToString, stringToNumber)("fo");
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for compose-function
|
||||
// Project: https://github.com/stoeffel/compose-function
|
||||
// Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
// Hardcoded signatures for 2-4 parameters
|
||||
declare function f<A, B, C>(
|
||||
f1: (b: B) => C,
|
||||
f2: (a: A) => B
|
||||
): (a: A) => C
|
||||
declare function f<A, B, C, D>(
|
||||
f1: (b: C) => D,
|
||||
f2: (a: B) => C,
|
||||
f3: (a: A) => B
|
||||
): (a: A) => D
|
||||
declare function f<A, B, C, D, E>(
|
||||
f1: (b: D) => E,
|
||||
f2: (a: C) => D,
|
||||
f3: (a: B) => C,
|
||||
f4: (a: A) => B
|
||||
): (a: A) => E
|
||||
|
||||
// Minimal typing for more than 4 parameters
|
||||
declare function f<Result>(
|
||||
f1: (a: any) => Result,
|
||||
...functions: Function[]
|
||||
): (a: any) => Result
|
||||
|
||||
export = f;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"compose-function-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user