Closed
Description
TypeScript Version: 2.1.1
Code
// A *self-contained* demonstration of the problem follows...
function* myGen() {
yield "foo";
}
let gen = myGen();
gen.throw(new Error("err"));
Compiled with the command
tsc --strictNullChecks --target ES6 example.ts
Expected behavior:
Compilation passes successfully.
Actual behavior:
example.ts(8,1): error TS2532: Object is possibly 'undefined'.
The error is on the gen.throw() line.
I have already tried putting undefined checks, assigning a local variable, trycatch blocks etc in the code but the error persists.
Metadata
Metadata
Assignees
Labels
No labels