-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".FixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
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:
Metadata
Metadata
Assignees
Labels
Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".FixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript