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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
//// [tests/cases/compiler/exportDefaultAsyncFunction2.ts] ////
//// [asyncawait.ts]
export function async<T>(...args: any[]): any { }
export function await(...args: any[]): any { }
//// [a.ts]
import { async, await } from 'asyncawait';
export default async(() => await(Promise.resolve(1)));
//// [b.ts]
export default async () => { return 0; };
//// [c.ts]
import { async, await } from 'asyncawait';
export default async<number>();
//// [d.ts]
import { async, await } from 'asyncawait';
export default async;
//// [e.ts]
import { async, await } from 'asyncawait';
export default async
export function foo() { }
//// [asyncawait.js]
export function async(...args) { }
export function await(...args) { }
//// [a.js]
import { async, await } from 'asyncawait';
export default async(() => await(Promise.resolve(1)));
//// [b.js]
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());
});
};
export default () => __awaiter(this, void 0, void 0, function* () { return 0; });
//// [c.js]
import { async } from 'asyncawait';
export default async();
//// [d.js]
import { async } from 'asyncawait';
export default async;
//// [e.js]
import { async } from 'asyncawait';
export default async;
export function foo() { }
|