|
| 1 | +//// [reachabilityChecks7.ts] |
| 2 | + |
| 3 | +// async function without return type annotation - error |
| 4 | +async function f1() { |
| 5 | +} |
| 6 | + |
| 7 | +let x = async function() { |
| 8 | +} |
| 9 | + |
| 10 | +// async function with which promised type is void - return can be omitted |
| 11 | +async function f2(): Promise<void> { |
| 12 | + |
| 13 | +} |
| 14 | + |
| 15 | +//// [reachabilityChecks7.js] |
| 16 | +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { |
| 17 | + return new Promise(function (resolve, reject) { |
| 18 | + generator = generator.call(thisArg, _arguments); |
| 19 | + function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } |
| 20 | + function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } |
| 21 | + function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } |
| 22 | + function step(verb, value) { |
| 23 | + var result = generator[verb](value); |
| 24 | + result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); |
| 25 | + } |
| 26 | + step("next", void 0); |
| 27 | + }); |
| 28 | +}; |
| 29 | +// async function without return type annotation - error |
| 30 | +function f1() { |
| 31 | + return __awaiter(this, void 0, Promise, function* () { |
| 32 | + }); |
| 33 | +} |
| 34 | +let x = function () { |
| 35 | + return __awaiter(this, void 0, Promise, function* () { |
| 36 | + }); |
| 37 | +}; |
| 38 | +// async function with which promised type is void - return can be omitted |
| 39 | +function f2() { |
| 40 | + return __awaiter(this, void 0, Promise, function* () { |
| 41 | + }); |
| 42 | +} |
0 commit comments