Open
Description
TypeScript Version: 2.2.1
Code
async function example() {
// result.value will be promise
const promise = Promise.resolve("foo");
await promise;
// result.value will be "foo"
return "foo";
}
Expected behavior:
Ignoring __awaiter
and __generator
, the output should include // result.value will be promise
Actual behavior:
function example() {
return __awaiter(this, void 0, void 0, function () {
var promise;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
promise = Promise.resolve("foo");
return [4 /*yield*/, promise];
case 1:
_a.sent();
// result.value will be "foo"
return [2 /*return*/, "foo"];
}
});
});
}