mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-05 09:40:02 +00:00
p-try: upgrade typings for v2.0
This commit is contained in:
10
types/p-try/index.d.ts
vendored
10
types/p-try/index.d.ts
vendored
@@ -1,8 +1,16 @@
|
||||
// Type definitions for p-try 1.0
|
||||
// Type definitions for p-try 2.0
|
||||
// Project: https://github.com/sindresorhus/p-try#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = pTry;
|
||||
|
||||
declare function pTry<T, A, B, C, D, E, F>(cb: (a: A, b: B, c: C, d: D, e: E, f: F, ...args: any[]) => Promise<T> | PromiseLike<T> | T, a: A, b: B, c: C, d: D, e: E, f: F, ...args: any[]): Promise<T>;
|
||||
declare function pTry<T, A, B, C, D, E, F>(cb: (a: A, b: B, c: C, d: D, e: E, f: F) => Promise<T> | PromiseLike<T> | T, a: A, b: B, c: C, d: D, e: E, f: F): Promise<T>;
|
||||
declare function pTry<T, A, B, C, D, E>(cb: (a: A, b: B, c: C, d: D, e: E) => Promise<T> | PromiseLike<T> | T, a: A, b: B, c: C, d: D, e: E): Promise<T>;
|
||||
declare function pTry<T, A, B, C, D>(cb: (a: A, b: B, c: C, d: D) => Promise<T> | PromiseLike<T> | T, a: A, b: B, c: C, d: D): Promise<T>;
|
||||
declare function pTry<T, A, B, C>(cb: (a: A, b: B, c: C) => Promise<T> | PromiseLike<T> | T, a: A, b: B, c: C): Promise<T>;
|
||||
declare function pTry<T, A, B>(cb: (a: A, b: B) => Promise<T> | PromiseLike<T> | T, a: A, b: B): Promise<T>;
|
||||
declare function pTry<T, A>(cb: (a: A) => Promise<T> | PromiseLike<T> | T, a: A): Promise<T>;
|
||||
declare function pTry<T>(cb: () => Promise<T> | PromiseLike<T> | T): Promise<T>;
|
||||
|
||||
@@ -14,3 +14,23 @@ pTry(() => Promise.resolve('foo')).then(value => {
|
||||
pTry(throws).then(value => {
|
||||
str = value;
|
||||
});
|
||||
|
||||
declare function a(a: string): string;
|
||||
declare function b(a: string, b: number): string;
|
||||
declare function c(a: string, b: number, c: boolean): string;
|
||||
declare function d(a: string, b: number, c: boolean, d: symbol): string;
|
||||
declare function e(a: string, b: number, c: boolean, d: symbol, e: 'yes' | 'no'): string;
|
||||
declare function f(a: string, b: number, c: boolean, d: symbol, e: 'yes' | 'no', f: 1 | 2): string;
|
||||
declare function g(a: string, b: number, c: boolean, d: symbol, e: 'yes' | 'no', f: 1 | 2, g: true): string;
|
||||
|
||||
pTry(a, 'test').then(v => { str = v; });
|
||||
pTry(b, 'test', 1).then(v => { str = v; });
|
||||
pTry(c, 'test', 1, false).then(v => { str = v; });
|
||||
pTry(d, 'test', 1, false, Symbol('test')).then(v => { str = v; });
|
||||
pTry(e, 'test', 1, false, Symbol('test'), 'no').then(v => { str = v; });
|
||||
pTry(f, 'test', 1, false, Symbol('test'), 'no', 2).then(v => { str = v; });
|
||||
pTry(g, 'test', 1, false, Symbol('test'), 'no', 2, true).then(v => { str = v; });
|
||||
|
||||
declare function add(...args: number[]): number;
|
||||
|
||||
pTry(add, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).then(v => (v === 91));
|
||||
|
||||
Reference in New Issue
Block a user