-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathdeclarationEmitPromise.ts
More file actions
26 lines (23 loc) · 1 KB
/
declarationEmitPromise.ts
File metadata and controls
26 lines (23 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// @declaration: true
// @noImplicitThis: false
// @module: commonjs
// @target: es6
export class bluebird<T> {
static all: Array<bluebird<any>>;
}
export async function runSampleWorks<A, B, C, D, E>(
a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) {
let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el));
let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T =>
f.apply(this, result);
let rfunc: typeof func & {} = func as any; // <- This is the only difference
return rfunc
}
export async function runSampleBreaks<A, B, C, D, E>(
a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) {
let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el));
let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T =>
f.apply(this, result);
let rfunc: typeof func = func as any; // <- This is the only difference
return rfunc
}