Closed
Description
TypeScript Version: 2.1.0-dev.20160821
Code
// Just for reference... the error here is correct and expected
function* foo() {
!yield 42; // ERROR: Expression expected
}
// This one emits bad code...
async function bar() {
!await 42; // OK
}
// ----------
// generated .js code for the bar function:
function bar() {
return __awaiter(this, void 0, void 0, function* () {
!yield 42; // <===== (1) bad emit here
});
}
Expected behavior:
The emitted code is valid.
Actual behavior:
The emitted code is invalid at (1). !yield 42
is not a valid expression as demonstrated in the foo
function. Also the generated code fails at runtime at (1) in both V8 and Edge.