Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong referenced symbol in parameter intializer #26808

Closed
ajafff opened this issue Aug 31, 2018 · 0 comments · Fixed by #26810
Closed

wrong referenced symbol in parameter intializer #26808

ajafff opened this issue Aug 31, 2018 · 0 comments · Fixed by #26810
Labels
Bug A bug in TypeScript

Comments

@ajafff
Copy link
Contributor

ajafff commented Aug 31, 2018

TypeScript Version: 3.1.0-dev.20180831

Search Terms:

Code

// @target: ES2016
let foo = 1;
function test(bar = foo, foo = '') {}

Expected behavior:

foo in the initializer of bar references the parameter foo of type string.
Use before declare error for foo.

Actual behavior:

foo in the initializer of bar references the outer variable declaration foo of type number.
No use before declare error.
Exception when running this code.

Related Issues:
introduced by #26317 while trying to fix #22769
#26762

/cc @Kingwl again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants