1//// [declarationEmitPromise.ts] 2export class bluebird<T> { 3 static all: Array<bluebird<any>>; 4} 5 6export async function runSampleWorks<A, B, C, D, E>( 7 a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) { 8 let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); 9 let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => 10 f.apply(this, result); 11 let rfunc: typeof func & {} = func as any; // <- This is the only difference 12 return rfunc 13} 14 15export async function runSampleBreaks<A, B, C, D, E>( 16 a: bluebird<A>, b?: bluebird<B>, c?: bluebird<C>, d?: bluebird<D>, e?: bluebird<E>) { 17 let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); 18 let func = <T>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => 19 f.apply(this, result); 20 let rfunc: typeof func = func as any; // <- This is the only difference 21 return rfunc 22} 23 24//// [declarationEmitPromise.js] 25"use strict"; 26var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 27 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 28 return new (P || (P = Promise))(function (resolve, reject) { 29 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 30 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 31 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 32 step((generator = generator.apply(thisArg, _arguments || [])).next()); 33 }); 34}; 35Object.defineProperty(exports, "__esModule", { value: true }); 36exports.runSampleBreaks = exports.runSampleWorks = exports.bluebird = void 0; 37class bluebird { 38} 39exports.bluebird = bluebird; 40function runSampleWorks(a, b, c, d, e) { 41 return __awaiter(this, void 0, void 0, function* () { 42 let result = yield bluebird.all([a, b, c, d, e].filter(el => !!el)); 43 let func = (f) => f.apply(this, result); 44 let rfunc = func; // <- This is the only difference 45 return rfunc; 46 }); 47} 48exports.runSampleWorks = runSampleWorks; 49function runSampleBreaks(a, b, c, d, e) { 50 return __awaiter(this, void 0, void 0, function* () { 51 let result = yield bluebird.all([a, b, c, d, e].filter(el => !!el)); 52 let func = (f) => f.apply(this, result); 53 let rfunc = func; // <- This is the only difference 54 return rfunc; 55 }); 56} 57exports.runSampleBreaks = runSampleBreaks; 58 59 60//// [declarationEmitPromise.d.ts] 61export declare class bluebird<T> { 62 static all: Array<bluebird<any>>; 63} 64export 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)>; 65export 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)>; 66