TypeScript Version: 2.8.0-dev.20180321
Search Terms:
Code
let foo = 1;
(function (bar = foo) { // unexpected compiler error; works at runtime
var foo = 2;
return bar; // returns 1
})();
(function (bar = (baz = foo) => baz) { // unexpected compiler error; works at runtime
var foo = 2;
return bar(); // returns 1
})();
(function (bar = foo, foo = 2) { // correct compiler error, error at runtime
return bar;
})();
Expected behavior:
No error on the first and second function expressions
This used to work in a previous release.
Actual behavior:
Compiler error on the first two function declarations even though the code works at runtime.
Initializer of parameter 'bar' cannot reference identifier 'foo' declared after it.
Variable 'foo' is used before being assigned.
Playground Link:
Related Issues:
TypeScript Version: 2.8.0-dev.20180321
Search Terms:
Code
Expected behavior:
No error on the first and second function expressions
This used to work in a previous release.
Actual behavior:
Compiler error on the first two function declarations even though the code works at runtime.
Playground Link:
Related Issues: