Skip to content

Don't consider 'typeof a' as using 'a' #28528

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

Merged
3 commits merged into from
Nov 16, 2018
Merged

Don't consider 'typeof a' as using 'a' #28528

3 commits merged into from
Nov 16, 2018

Conversation

ghost
Copy link

@ghost ghost commented Nov 14, 2018

Fixes a bug where a variable that was only ever used in a typeof expression was still considered used.

@ghost ghost requested a review from sheetalkamat November 14, 2018 20:01
@@ -55,6 +55,7 @@ namespace ts {
let cancellationToken: CancellationToken | undefined;
let requestedExternalEmitHelpers: ExternalEmitHelpers;
let externalHelpersModule: Symbol;
let isInTypeOf = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need this? You can get this in resolveNameHelper by doing findAncestor on location?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but climbing ancestors has been bad for performance in the past (#17831, #17721). 99% of the time the expression won't be in a typeof and we'll have to climb all the way to the root.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already isInTypeQuery

@ghost ghost merged commit 0c4ceee into master Nov 16, 2018
@ghost ghost deleted the isInTypeOf branch November 16, 2018 16:35
sandersn added a commit that referenced this pull request Nov 26, 2018
sandersn added a commit that referenced this pull request Nov 26, 2018
sandersn added a commit that referenced this pull request Nov 26, 2018
Revert "Don't consider 'typeof a' as using 'a' (#28528)"
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant