Add the test case for #8105
This commit is contained in:
parent
3e2fff2150
commit
87b64c5b28
122
tests/baselines/reference/declarationEmitPromise.js
Normal file
122
tests/baselines/reference/declarationEmitPromise.js
Normal file
|
@ -0,0 +1,122 @@
|
|||
//// [declarationEmitPromise.ts]
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//// [declarationEmitPromise.js]
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
class bluebird {
|
||||
}
|
||||
exports.bluebird = bluebird;
|
||||
function runSampleWorks(a, b, c, d, e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let result = yield bluebird.all([a, b, c, d, e].filter(el => !!el));
|
||||
let func = (f) => f.apply(this, result);
|
||||
let rfunc = func; // <- This is the only difference
|
||||
return rfunc;
|
||||
});
|
||||
}
|
||||
exports.runSampleWorks = runSampleWorks;
|
||||
function runSampleBreaks(a, b, c, d, e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let result = yield bluebird.all([a, b, c, d, e].filter(el => !!el));
|
||||
let func = (f) => f.apply(this, result);
|
||||
let rfunc = func; // <- This is the only difference
|
||||
return rfunc;
|
||||
});
|
||||
}
|
||||
exports.runSampleBreaks = runSampleBreaks;
|
||||
|
||||
|
||||
//// [declarationEmitPromise.d.ts]
|
||||
export declare class bluebird<T> {
|
||||
static all: Array<bluebird<any>>;
|
||||
}
|
||||
export declare function runSampleWorks<A, B, C, D, E>(a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>): Promise<(<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {}>;
|
||||
export declare function runSampleBreaks<A, B, C, D, E>(a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>): Promise<<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T>;
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,141): error TS2314: Generic type 'Promise<T>' requires 1 type argument(s).
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,148): error TS1144: '{' or ';' expected.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,150): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,153): error TS2304: Cannot find name 'f'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,154): error TS1005: ')' expected.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,160): error TS2304: Cannot find name 'A'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,167): error TS2304: Cannot find name 'B'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,174): error TS2304: Cannot find name 'C'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,181): error TS2304: Cannot find name 'D'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,188): error TS2304: Cannot find name 'E'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,194): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,195): error TS1005: ';' expected.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,197): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,200): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/declarationEmitPromise.d.ts(5,202): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitPromise.d.ts (15 errors) ====
|
||||
export declare class bluebird<T> {
|
||||
static all: Array<bluebird<any>>;
|
||||
}
|
||||
export declare function runSampleWorks<A, B, C, D, E>(a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>): Promise<(<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {}>;
|
||||
export declare function runSampleBreaks<A, B, C, D, E>(a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>): Promise<<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T>;
|
||||
~~~~~~~
|
||||
!!! error TS2314: Generic type 'Promise<T>' requires 1 type argument(s).
|
||||
~~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'f'.
|
||||
~
|
||||
!!! error TS1005: ')' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'A'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'B'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'C'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'D'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'E'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
|
155
tests/baselines/reference/declarationEmitPromise.symbols
Normal file
155
tests/baselines/reference/declarationEmitPromise.symbols
Normal file
|
@ -0,0 +1,155 @@
|
|||
=== tests/cases/compiler/declarationEmitPromise.ts ===
|
||||
|
||||
export class bluebird<T> {
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 1, 22))
|
||||
|
||||
static all: Array<bluebird<any>>;
|
||||
>all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
}
|
||||
|
||||
export async function runSampleWorks<A, B, C, D, E>(
|
||||
>runSampleWorks : Symbol(runSampleWorks, Decl(declarationEmitPromise.ts, 3, 1))
|
||||
>A : Symbol(A, Decl(declarationEmitPromise.ts, 5, 37))
|
||||
>B : Symbol(B, Decl(declarationEmitPromise.ts, 5, 39))
|
||||
>C : Symbol(C, Decl(declarationEmitPromise.ts, 5, 42))
|
||||
>D : Symbol(D, Decl(declarationEmitPromise.ts, 5, 45))
|
||||
>E : Symbol(E, Decl(declarationEmitPromise.ts, 5, 48))
|
||||
|
||||
a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) {
|
||||
>a : Symbol(a, Decl(declarationEmitPromise.ts, 5, 52))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(declarationEmitPromise.ts, 5, 37))
|
||||
>b : Symbol(b, Decl(declarationEmitPromise.ts, 6, 19))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(declarationEmitPromise.ts, 5, 39))
|
||||
>c : Symbol(c, Decl(declarationEmitPromise.ts, 6, 36))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>C : Symbol(C, Decl(declarationEmitPromise.ts, 5, 42))
|
||||
>d : Symbol(d, Decl(declarationEmitPromise.ts, 6, 53))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>D : Symbol(D, Decl(declarationEmitPromise.ts, 5, 45))
|
||||
>e : Symbol(e, Decl(declarationEmitPromise.ts, 6, 70))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>E : Symbol(E, Decl(declarationEmitPromise.ts, 5, 48))
|
||||
|
||||
let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el));
|
||||
>result : Symbol(result, Decl(declarationEmitPromise.ts, 7, 7))
|
||||
>bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26))
|
||||
>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(declarationEmitPromise.ts, 5, 52))
|
||||
>b : Symbol(b, Decl(declarationEmitPromise.ts, 6, 19))
|
||||
>c : Symbol(c, Decl(declarationEmitPromise.ts, 6, 36))
|
||||
>d : Symbol(d, Decl(declarationEmitPromise.ts, 6, 53))
|
||||
>e : Symbol(e, Decl(declarationEmitPromise.ts, 6, 70))
|
||||
>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --))
|
||||
>el : Symbol(el, Decl(declarationEmitPromise.ts, 7, 68))
|
||||
>el : Symbol(el, Decl(declarationEmitPromise.ts, 7, 68))
|
||||
|
||||
let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T =>
|
||||
>func : Symbol(func, Decl(declarationEmitPromise.ts, 8, 7))
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 8, 16))
|
||||
>f : Symbol(f, Decl(declarationEmitPromise.ts, 8, 19))
|
||||
>a : Symbol(a, Decl(declarationEmitPromise.ts, 8, 23))
|
||||
>A : Symbol(A, Decl(declarationEmitPromise.ts, 5, 37))
|
||||
>b : Symbol(b, Decl(declarationEmitPromise.ts, 8, 28))
|
||||
>B : Symbol(B, Decl(declarationEmitPromise.ts, 5, 39))
|
||||
>c : Symbol(c, Decl(declarationEmitPromise.ts, 8, 35))
|
||||
>C : Symbol(C, Decl(declarationEmitPromise.ts, 5, 42))
|
||||
>d : Symbol(d, Decl(declarationEmitPromise.ts, 8, 42))
|
||||
>D : Symbol(D, Decl(declarationEmitPromise.ts, 5, 45))
|
||||
>e : Symbol(e, Decl(declarationEmitPromise.ts, 8, 49))
|
||||
>E : Symbol(E, Decl(declarationEmitPromise.ts, 5, 48))
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 8, 16))
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 8, 16))
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>f : Symbol(f, Decl(declarationEmitPromise.ts, 8, 19))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>result : Symbol(result, Decl(declarationEmitPromise.ts, 7, 7))
|
||||
|
||||
let rfunc: typeof func & {} = func as any; // <- This is the only difference
|
||||
>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 10, 7))
|
||||
>func : Symbol(func, Decl(declarationEmitPromise.ts, 8, 7))
|
||||
>func : Symbol(func, Decl(declarationEmitPromise.ts, 8, 7))
|
||||
|
||||
return rfunc
|
||||
>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 10, 7))
|
||||
}
|
||||
|
||||
export async function runSampleBreaks<A, B, C, D, E>(
|
||||
>runSampleBreaks : Symbol(runSampleBreaks, Decl(declarationEmitPromise.ts, 12, 1))
|
||||
>A : Symbol(A, Decl(declarationEmitPromise.ts, 14, 38))
|
||||
>B : Symbol(B, Decl(declarationEmitPromise.ts, 14, 40))
|
||||
>C : Symbol(C, Decl(declarationEmitPromise.ts, 14, 43))
|
||||
>D : Symbol(D, Decl(declarationEmitPromise.ts, 14, 46))
|
||||
>E : Symbol(E, Decl(declarationEmitPromise.ts, 14, 49))
|
||||
|
||||
a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) {
|
||||
>a : Symbol(a, Decl(declarationEmitPromise.ts, 14, 53))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(declarationEmitPromise.ts, 14, 38))
|
||||
>b : Symbol(b, Decl(declarationEmitPromise.ts, 15, 19))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(declarationEmitPromise.ts, 14, 40))
|
||||
>c : Symbol(c, Decl(declarationEmitPromise.ts, 15, 36))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>C : Symbol(C, Decl(declarationEmitPromise.ts, 14, 43))
|
||||
>d : Symbol(d, Decl(declarationEmitPromise.ts, 15, 53))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>D : Symbol(D, Decl(declarationEmitPromise.ts, 14, 46))
|
||||
>e : Symbol(e, Decl(declarationEmitPromise.ts, 15, 70))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>E : Symbol(E, Decl(declarationEmitPromise.ts, 14, 49))
|
||||
|
||||
let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el));
|
||||
>result : Symbol(result, Decl(declarationEmitPromise.ts, 16, 7))
|
||||
>bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26))
|
||||
>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0))
|
||||
>all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26))
|
||||
>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(declarationEmitPromise.ts, 14, 53))
|
||||
>b : Symbol(b, Decl(declarationEmitPromise.ts, 15, 19))
|
||||
>c : Symbol(c, Decl(declarationEmitPromise.ts, 15, 36))
|
||||
>d : Symbol(d, Decl(declarationEmitPromise.ts, 15, 53))
|
||||
>e : Symbol(e, Decl(declarationEmitPromise.ts, 15, 70))
|
||||
>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --))
|
||||
>el : Symbol(el, Decl(declarationEmitPromise.ts, 16, 68))
|
||||
>el : Symbol(el, Decl(declarationEmitPromise.ts, 16, 68))
|
||||
|
||||
let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T =>
|
||||
>func : Symbol(func, Decl(declarationEmitPromise.ts, 17, 7))
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 17, 16))
|
||||
>f : Symbol(f, Decl(declarationEmitPromise.ts, 17, 19))
|
||||
>a : Symbol(a, Decl(declarationEmitPromise.ts, 17, 23))
|
||||
>A : Symbol(A, Decl(declarationEmitPromise.ts, 14, 38))
|
||||
>b : Symbol(b, Decl(declarationEmitPromise.ts, 17, 28))
|
||||
>B : Symbol(B, Decl(declarationEmitPromise.ts, 14, 40))
|
||||
>c : Symbol(c, Decl(declarationEmitPromise.ts, 17, 35))
|
||||
>C : Symbol(C, Decl(declarationEmitPromise.ts, 14, 43))
|
||||
>d : Symbol(d, Decl(declarationEmitPromise.ts, 17, 42))
|
||||
>D : Symbol(D, Decl(declarationEmitPromise.ts, 14, 46))
|
||||
>e : Symbol(e, Decl(declarationEmitPromise.ts, 17, 49))
|
||||
>E : Symbol(E, Decl(declarationEmitPromise.ts, 14, 49))
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 17, 16))
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 17, 16))
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>f : Symbol(f, Decl(declarationEmitPromise.ts, 17, 19))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>result : Symbol(result, Decl(declarationEmitPromise.ts, 16, 7))
|
||||
|
||||
let rfunc: typeof func = func as any; // <- This is the only difference
|
||||
>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 19, 7))
|
||||
>func : Symbol(func, Decl(declarationEmitPromise.ts, 17, 7))
|
||||
>func : Symbol(func, Decl(declarationEmitPromise.ts, 17, 7))
|
||||
|
||||
return rfunc
|
||||
>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 19, 7))
|
||||
}
|
181
tests/baselines/reference/declarationEmitPromise.types
Normal file
181
tests/baselines/reference/declarationEmitPromise.types
Normal file
|
@ -0,0 +1,181 @@
|
|||
=== tests/cases/compiler/declarationEmitPromise.ts ===
|
||||
|
||||
export class bluebird<T> {
|
||||
>bluebird : bluebird<T>
|
||||
>T : T
|
||||
|
||||
static all: Array<bluebird<any>>;
|
||||
>all : bluebird<any>[]
|
||||
>Array : T[]
|
||||
>bluebird : bluebird<T>
|
||||
}
|
||||
|
||||
export async function runSampleWorks<A, B, C, D, E>(
|
||||
>runSampleWorks : <A, B, C, D, E>(a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) => Promise<(<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {}>
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
>D : D
|
||||
>E : E
|
||||
|
||||
a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) {
|
||||
>a : bluebird<A>
|
||||
>bluebird : bluebird<T>
|
||||
>A : A
|
||||
>b : bluebird<B>
|
||||
>bluebird : bluebird<T>
|
||||
>B : B
|
||||
>c : bluebird<C>
|
||||
>bluebird : bluebird<T>
|
||||
>C : C
|
||||
>d : bluebird<D>
|
||||
>bluebird : bluebird<T>
|
||||
>D : D
|
||||
>e : bluebird<E>
|
||||
>bluebird : bluebird<T>
|
||||
>E : E
|
||||
|
||||
let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el));
|
||||
>result : any
|
||||
>await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any
|
||||
>(bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any
|
||||
>(bluebird.all as any) : any
|
||||
>bluebird.all as any : any
|
||||
>bluebird.all : bluebird<any>[]
|
||||
>bluebird : typeof bluebird
|
||||
>all : bluebird<any>[]
|
||||
>[a, b, c, d, e].filter(el => !!el) : bluebird<A>[]
|
||||
>[a, b, c, d, e].filter : (callbackfn: (value: bluebird<A>, index: number, array: bluebird<A>[]) => any, thisArg?: any) => bluebird<A>[]
|
||||
>[a, b, c, d, e] : bluebird<A>[]
|
||||
>a : bluebird<A>
|
||||
>b : bluebird<B>
|
||||
>c : bluebird<C>
|
||||
>d : bluebird<D>
|
||||
>e : bluebird<E>
|
||||
>filter : (callbackfn: (value: bluebird<A>, index: number, array: bluebird<A>[]) => any, thisArg?: any) => bluebird<A>[]
|
||||
>el => !!el : (el: bluebird<A>) => boolean
|
||||
>el : bluebird<A>
|
||||
>!!el : boolean
|
||||
>!el : boolean
|
||||
>el : bluebird<A>
|
||||
|
||||
let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T =>
|
||||
>func : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
><T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => f.apply(this, result) : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
>T : T
|
||||
>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T
|
||||
>a : A
|
||||
>A : A
|
||||
>b : B
|
||||
>B : B
|
||||
>c : C
|
||||
>C : C
|
||||
>d : D
|
||||
>D : D
|
||||
>e : E
|
||||
>E : E
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply(this, result) : T
|
||||
>f.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>this : any
|
||||
>result : any
|
||||
|
||||
let rfunc: typeof func & {} = func as any; // <- This is the only difference
|
||||
>rfunc : (<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {}
|
||||
>func : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
>func as any : any
|
||||
>func : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
|
||||
return rfunc
|
||||
>rfunc : (<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {}
|
||||
}
|
||||
|
||||
export async function runSampleBreaks<A, B, C, D, E>(
|
||||
>runSampleBreaks : <A, B, C, D, E>(a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) => Promise<<T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T>
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
>D : D
|
||||
>E : E
|
||||
|
||||
a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) {
|
||||
>a : bluebird<A>
|
||||
>bluebird : bluebird<T>
|
||||
>A : A
|
||||
>b : bluebird<B>
|
||||
>bluebird : bluebird<T>
|
||||
>B : B
|
||||
>c : bluebird<C>
|
||||
>bluebird : bluebird<T>
|
||||
>C : C
|
||||
>d : bluebird<D>
|
||||
>bluebird : bluebird<T>
|
||||
>D : D
|
||||
>e : bluebird<E>
|
||||
>bluebird : bluebird<T>
|
||||
>E : E
|
||||
|
||||
let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el));
|
||||
>result : any
|
||||
>await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any
|
||||
>(bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any
|
||||
>(bluebird.all as any) : any
|
||||
>bluebird.all as any : any
|
||||
>bluebird.all : bluebird<any>[]
|
||||
>bluebird : typeof bluebird
|
||||
>all : bluebird<any>[]
|
||||
>[a, b, c, d, e].filter(el => !!el) : bluebird<A>[]
|
||||
>[a, b, c, d, e].filter : (callbackfn: (value: bluebird<A>, index: number, array: bluebird<A>[]) => any, thisArg?: any) => bluebird<A>[]
|
||||
>[a, b, c, d, e] : bluebird<A>[]
|
||||
>a : bluebird<A>
|
||||
>b : bluebird<B>
|
||||
>c : bluebird<C>
|
||||
>d : bluebird<D>
|
||||
>e : bluebird<E>
|
||||
>filter : (callbackfn: (value: bluebird<A>, index: number, array: bluebird<A>[]) => any, thisArg?: any) => bluebird<A>[]
|
||||
>el => !!el : (el: bluebird<A>) => boolean
|
||||
>el : bluebird<A>
|
||||
>!!el : boolean
|
||||
>!el : boolean
|
||||
>el : bluebird<A>
|
||||
|
||||
let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T =>
|
||||
>func : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
><T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => f.apply(this, result) : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
>T : T
|
||||
>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T
|
||||
>a : A
|
||||
>A : A
|
||||
>b : B
|
||||
>B : B
|
||||
>c : C
|
||||
>C : C
|
||||
>d : D
|
||||
>D : D
|
||||
>e : E
|
||||
>E : E
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply(this, result) : T
|
||||
>f.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>this : any
|
||||
>result : any
|
||||
|
||||
let rfunc: typeof func = func as any; // <- This is the only difference
|
||||
>rfunc : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
>func : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
>func as any : any
|
||||
>func : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
|
||||
return rfunc
|
||||
>rfunc : <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T
|
||||
}
|
25
tests/cases/compiler/declarationEmitPromise.ts
Normal file
25
tests/cases/compiler/declarationEmitPromise.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
// @declaration: true
|
||||
// @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
|
||||
}
|
Loading…
Reference in a new issue