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

Names used in nested functions should not be flagged as unsued #9403

Closed
mhegazy opened this issue Jun 28, 2016 · 2 comments
Closed

Names used in nested functions should not be flagged as unsued #9403

mhegazy opened this issue Jun 28, 2016 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@mhegazy
Copy link
Contributor

mhegazy commented Jun 28, 2016

function f(a) {
    function b() {
        a++;
    }
    b();
}

a should not be marked us unused

@mhegazy mhegazy added the Bug A bug in TypeScript label Jun 28, 2016
@mhegazy mhegazy added this to the TypeScript 2.0 milestone Jun 28, 2016
@zpdDG4gta8XKpMCd
Copy link

how is this going to work with

fiction third(x:any, y: any, z: T) : T { return z; }

@mhegazy mhegazy assigned mhegazy and unassigned sarangan12 Jun 29, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jun 30, 2016
@mhegazy mhegazy closed this as completed Jun 30, 2016
@speigg
Copy link

speigg commented Aug 8, 2016

This does not seem to be fixed yet. I'm seeing the same problem with nested (arrow) functions.

This works:

const x = 1;
setTimeout(function() { console.log(x) })

This marks x as unused (incorrectly):

const x = 1;
setTimeout(() => console.log(x))

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants