mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
delete ts3.3/
This commit is contained in:
parent
3ca7a91353
commit
19512db954
@ -1,81 +0,0 @@
|
||||
import bind = require('function-bind');
|
||||
|
||||
const string = String(Math.random());
|
||||
const number = Math.random();
|
||||
const boolean = Math.random() >= 0.5;
|
||||
|
||||
/**
|
||||
* The `expectType` function from https://www.npmjs.com/package/tsd,
|
||||
* except instead of returning `void`, it returns `T`.
|
||||
*/
|
||||
declare function expectType<T>(value: T): T;
|
||||
|
||||
// $ExpectType (thisArg: any, start?: number | undefined, end?: number | undefined) => any[]
|
||||
const slice = expectType<(thisArg: any, start?: number, end?: number) => any[]>(
|
||||
bind.call(Function.call, Array.prototype.slice),
|
||||
);
|
||||
|
||||
// $ExpectType (start?: number | undefined, end?: number | undefined) => any[]
|
||||
const sliceBoundThis = expectType<(start?: number, end?: number) => any[]>(
|
||||
bind.call(Function.call, Array.prototype.slice, null),
|
||||
);
|
||||
|
||||
// $ExpectType (end?: number | undefined) => any[]
|
||||
const sliceBoundThisAndStart = expectType<(end?: number) => any[]>(
|
||||
bind.call(Function.call, Array.prototype.slice, ['a'], 1),
|
||||
);
|
||||
|
||||
slice(['a']);
|
||||
|
||||
// $ExpectType (...args: string[]) => boolean
|
||||
bind.call(Boolean, null, String(), '2', '3', '4', '5');
|
||||
|
||||
// $ExpectType (...args: string[]) => boolean
|
||||
bind.apply(Boolean, [null, '1', '2', '3', '4', '5']);
|
||||
|
||||
// Class compatibility:
|
||||
class Foo {
|
||||
constructor(public string: string, public number: number) {}
|
||||
}
|
||||
|
||||
// bind.call():
|
||||
// $ExpectType new (string: string, number: number) => Foo
|
||||
bind.call(Foo, null);
|
||||
// Foo.bind(null);
|
||||
|
||||
// $ExpectType new (number: number) => Foo
|
||||
bind.call(Foo, null, string);
|
||||
// Foo.bind(null, string);
|
||||
|
||||
// $ExpectType new () => Foo
|
||||
bind.call(Foo, null, string, number);
|
||||
// Foo.bind(null, string, number);
|
||||
|
||||
// $ExpectType new () => Foo
|
||||
bind.call(Foo, null, string, number, boolean);
|
||||
// Foo.bind(null, string, number, boolean);
|
||||
|
||||
// $ExpectType new () => Foo
|
||||
bind.call(Foo, null, string, number, boolean, undefined);
|
||||
// Foo.bind(null, string, number, boolean, undefined);
|
||||
|
||||
// bind.apply():
|
||||
// $ExpectType new (string: string, number: number) => Foo
|
||||
bind.apply(Foo, [null]);
|
||||
// Foo.bind(...[null]);
|
||||
|
||||
// $ExpectType new (number: number) => Foo
|
||||
bind.apply(Foo, [null, string]);
|
||||
// Foo.bind(...[null, string]);
|
||||
|
||||
// $ExpectType new () => Foo
|
||||
bind.apply(Foo, [null, string, number]);
|
||||
// Foo.bind(...[null, string, number]);
|
||||
|
||||
// $ExpectType new () => Foo
|
||||
bind.apply(Foo, [null, string, number, boolean]);
|
||||
// Foo.bind(...[null, string, number, boolean]);
|
||||
|
||||
// $ExpectType new () => Foo
|
||||
bind.apply(Foo, [null, string, number, boolean, undefined]);
|
||||
// Foo.bind(...[null, string, number, boolean, undefined]);
|
||||
183
types/function-bind/ts3.3/implementation.d.ts
vendored
183
types/function-bind/ts3.3/implementation.d.ts
vendored
@ -1,183 +0,0 @@
|
||||
//#region bind():
|
||||
/**
|
||||
* For a given function, creates a bound function that has the same body as the original function.
|
||||
* The this object of the bound function is associated with the specified object, and has the specified initial parameters.
|
||||
* @param thisArg The object to be used as the this object.
|
||||
* @param args Arguments to bind to the parameters of the function.
|
||||
*/
|
||||
declare function bind<T>(this: T, thisArg: ThisParameterType<T>): OmitThisParameter<T>;
|
||||
declare function bind<T, A0, A extends any[], R>(
|
||||
this: (this: T, arg0: A0, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
): (...args: A) => R;
|
||||
declare function bind<T, A0, A1, A extends any[], R>(
|
||||
this: (this: T, arg0: A0, arg1: A1, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
): (...args: A) => R;
|
||||
declare function bind<T, A0, A1, A2, A extends any[], R>(
|
||||
this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
): (...args: A) => R;
|
||||
declare function bind<T, A0, A1, A2, A3, A extends any[], R>(
|
||||
this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
arg3: A3,
|
||||
): (...args: A) => R;
|
||||
declare function bind<T, AX, R>(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R;
|
||||
|
||||
declare function bind<T>(this: T, thisArg: any): T;
|
||||
declare function bind<A0, A extends any[], R>(
|
||||
this: new (arg0: A0, ...args: A) => R,
|
||||
thisArg: any,
|
||||
arg0: A0,
|
||||
): new (...args: A) => R;
|
||||
declare function bind<A0, A1, A extends any[], R>(
|
||||
this: new (arg0: A0, arg1: A1, ...args: A) => R,
|
||||
thisArg: any,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
): new (...args: A) => R;
|
||||
declare function bind<A0, A1, A2, A extends any[], R>(
|
||||
this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
|
||||
thisArg: any,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
): new (...args: A) => R;
|
||||
declare function bind<A0, A1, A2, A3, A extends any[], R>(
|
||||
this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
|
||||
thisArg: any,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
arg3: A3,
|
||||
): new (...args: A) => R;
|
||||
declare function bind<AX, R>(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R;
|
||||
//#endregion
|
||||
|
||||
declare namespace bind {
|
||||
//#region bind.call():
|
||||
/**
|
||||
* Creates a bound function with the specified object as the this value and the specified rest arguments as the arguments.
|
||||
* @param thisArg The object to be used as the this object.
|
||||
* @param args Argument values to be passed to the function.
|
||||
*/
|
||||
// CallableFunction:
|
||||
function call<T, A extends any[], R>(func: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R;
|
||||
function call<T, A0, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
): (...args: A) => R;
|
||||
function call<T, A0, A1, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, arg1: A1, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
): (...args: A) => R;
|
||||
function call<T, A0, A1, A2, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
): (...args: A) => R;
|
||||
function call<T, A0, A1, A2, A3, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
|
||||
thisArg: T,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
arg3: A3,
|
||||
): (...args: A) => R;
|
||||
function call<T, AX, R>(func: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R;
|
||||
|
||||
// NewableFunction:
|
||||
function call<A extends any[], R>(func: new (...args: A) => R, thisArg: unknown): new (...args: A) => R;
|
||||
function call<A0, A extends any[], R>(
|
||||
func: new (arg0: A0, ...args: A) => R,
|
||||
thisArg: unknown,
|
||||
arg0: A0,
|
||||
): new (...args: A) => R;
|
||||
function call<A0, A1, A extends any[], R>(
|
||||
func: new (arg0: A0, arg1: A1, ...args: A) => R,
|
||||
thisArg: unknown,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
): new (...args: A) => R;
|
||||
function call<A0, A1, A2, A extends any[], R>(
|
||||
func: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
|
||||
thisArg: unknown,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
): new (...args: A) => R;
|
||||
function call<A0, A1, A2, A3, A extends any[], R>(
|
||||
func: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
|
||||
thisArg: unknown,
|
||||
arg0: A0,
|
||||
arg1: A1,
|
||||
arg2: A2,
|
||||
arg3: A3,
|
||||
): new (...args: A) => R;
|
||||
function call<AX, R>(func: new (...args: AX[]) => R, thisArg: unknown, ...args: AX[]): new (...args: AX[]) => R;
|
||||
//#endregion
|
||||
|
||||
//#region bind.apply():
|
||||
/**
|
||||
* Creates a bound function with the specified object as the this value and the elements of specified array as the arguments.
|
||||
* @param thisArg The object to be used as the this object.
|
||||
* @param args An array of argument values to be passed to the function.
|
||||
*/
|
||||
// CallableFunction:
|
||||
function apply<T, A extends any[], R>(func: (this: T, ...args: A) => R, args: [T]): (...args: A) => R;
|
||||
function apply<T, A0, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, ...args: A) => R,
|
||||
args: [T, A0],
|
||||
): (...args: A) => R;
|
||||
function apply<T, A0, A1, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, arg1: A1, ...args: A) => R,
|
||||
args: [T, A0, A1],
|
||||
): (...args: A) => R;
|
||||
function apply<T, A0, A1, A2, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
|
||||
args: [T, A0, A1, A2],
|
||||
): (...args: A) => R;
|
||||
function apply<T, A0, A1, A2, A3, A extends any[], R>(
|
||||
func: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
|
||||
args: [T, A0, A1, A2, A3],
|
||||
): (...args: A) => R;
|
||||
function apply<T, AX, R>(func: (this: T, ...args: AX[]) => R, args: [T, ...AX[]]): (...args: AX[]) => R;
|
||||
|
||||
// NewableFunction:
|
||||
function apply<A extends any[], R>(func: new (...args: A) => R, args: [unknown]): new (...args: A) => R;
|
||||
function apply<A0, A extends any[], R>(
|
||||
func: new (arg0: A0, ...args: A) => R,
|
||||
args: [unknown, A0],
|
||||
): new (...args: A) => R;
|
||||
function apply<A0, A1, A extends any[], R>(
|
||||
func: new (arg0: A0, arg1: A1, ...args: A) => R,
|
||||
args: [unknown, A0, A1],
|
||||
): new (...args: A) => R;
|
||||
function apply<A0, A1, A2, A extends any[], R>(
|
||||
func: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
|
||||
args: [unknown, A0, A1, A2],
|
||||
): new (...args: A) => R;
|
||||
function apply<A0, A1, A2, A3, A extends any[], R>(
|
||||
func: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
|
||||
args: [unknown, A0, A1, A2, A3],
|
||||
): new (...args: A) => R;
|
||||
function apply<AX, R>(func: new (...args: AX[]) => R, args: [unknown, ...AX[]]): new (...args: AX[]) => R;
|
||||
//#endregion
|
||||
}
|
||||
|
||||
export = bind;
|
||||
2
types/function-bind/ts3.3/index.d.ts
vendored
2
types/function-bind/ts3.3/index.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
import bind = require('./implementation');
|
||||
export = bind;
|
||||
@ -1,19 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es5"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": ["../../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"function-bind-tests.ts",
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user