|
| 1 | +//// [noImplicitReturnsInAsync2.ts] |
| 2 | + |
| 3 | +// Should be an error, Promise<number>, currently retorted correctly |
| 4 | +async function test3(isError: boolean = true) { |
| 5 | + if (isError === true) { |
| 6 | + return 6; |
| 7 | + } |
| 8 | +} |
| 9 | + |
| 10 | +// Should not be an error, Promise<any>, currently **not** working |
| 11 | +async function test4(isError: boolean = true) { |
| 12 | + if (isError === true) { |
| 13 | + return undefined; |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +// should not be error, Promise<any> currently working correctly |
| 18 | +async function test5(isError: boolean = true): Promise<any> { //should not be error |
| 19 | + if (isError === true) { |
| 20 | + return undefined; |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | + |
| 25 | +// should be error, currently reported correctly |
| 26 | +async function test6(isError: boolean = true): Promise<number> { |
| 27 | + if (isError === true) { |
| 28 | + return undefined; |
| 29 | + } |
| 30 | +} |
| 31 | + |
| 32 | +// infered to be Promise<void>, should not be an error, currently reported correctly |
| 33 | +async function test7(isError: boolean = true) { |
| 34 | + if (isError === true) { |
| 35 | + return; |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +//// [noImplicitReturnsInAsync2.js] |
| 40 | +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { |
| 41 | + return new (P || (P = Promise))(function (resolve, reject) { |
| 42 | + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
| 43 | + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } |
| 44 | + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } |
| 45 | + step((generator = generator.apply(thisArg, _arguments)).next()); |
| 46 | + }); |
| 47 | +}; |
| 48 | +// Should be an error, Promise<number>, currently retorted correctly |
| 49 | +function test3(isError = true) { |
| 50 | + return __awaiter(this, void 0, void 0, function* () { |
| 51 | + if (isError === true) { |
| 52 | + return 6; |
| 53 | + } |
| 54 | + }); |
| 55 | +} |
| 56 | +// Should not be an error, Promise<any>, currently **not** working |
| 57 | +function test4(isError = true) { |
| 58 | + return __awaiter(this, void 0, void 0, function* () { |
| 59 | + if (isError === true) { |
| 60 | + return undefined; |
| 61 | + } |
| 62 | + }); |
| 63 | +} |
| 64 | +// should not be error, Promise<any> currently working correctly |
| 65 | +function test5(isError = true) { |
| 66 | + return __awaiter(this, void 0, void 0, function* () { |
| 67 | + if (isError === true) { |
| 68 | + return undefined; |
| 69 | + } |
| 70 | + }); |
| 71 | +} |
| 72 | +// should be error, currently reported correctly |
| 73 | +function test6(isError = true) { |
| 74 | + return __awaiter(this, void 0, void 0, function* () { |
| 75 | + if (isError === true) { |
| 76 | + return undefined; |
| 77 | + } |
| 78 | + }); |
| 79 | +} |
| 80 | +// infered to be Promise<void>, should not be an error, currently reported correctly |
| 81 | +function test7(isError = true) { |
| 82 | + return __awaiter(this, void 0, void 0, function* () { |
| 83 | + if (isError === true) { |
| 84 | + return; |
| 85 | + } |
| 86 | + }); |
| 87 | +} |
0 commit comments