Skip to content

Member mistakenly attached to expando function #56538

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

Closed
dragomirtitian opened this issue Nov 25, 2023 · 0 comments Β· Fixed by #56552
Closed

Member mistakenly attached to expando function #56538

dragomirtitian opened this issue Nov 25, 2023 · 0 comments Β· Fixed by #56552
Labels
Bug A bug in TypeScript
Milestone

Comments

@dragomirtitian
Copy link
Contributor

πŸ”Ž Search Terms

expando functions members shadowed

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground Link

πŸ’» Code

function X() { }
if(Math.random()) {
    const X: { test?: any } = {}
    X.test = 1
}

πŸ™ Actual behavior

test appears in declarations as a member of X, even though the function X is shadowed by a local variable

πŸ™‚ Expected behavior

test should not appear on X as it does not belong to it.

Additional information about the issue

Found while trying to detect expando functions in isolated declarations

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