Skip to content

Set '.declarations' on a property of a homomorphic mapped type #16059

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
2 commits merged into from
May 25, 2017

Conversation

ghost
Copy link

@ghost ghost commented May 24, 2017

Fixes #15821

@ghost ghost requested a review from sandersn May 24, 2017 15:33
@sandersn
Copy link
Member

The change looks good but I'll wait to approve it until after the test failures are fixed to make sure there aren't any big changes that result.

Copy link
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

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

The test failures need another look.

@ghost
Copy link
Author

ghost commented May 25, 2017

The bug in findAllRefsMappedType.ts was due to getSymbolScope not recognizing the mapped type property as a property. (Previously we would see symbol.declarations === undefined and immediately give up on getting a scope.) I changed it to always return undefined as soon as it sees that a symbol is a property or method -- I don't see why this wasn't done before.

@sandersn
Copy link
Member

I'm not fluent with findAllRefs, so there may be an obvious answer: if a property or method is public, wouldn't it still need to be part of an exported type to be visible anywhere?

@ghost
Copy link
Author

ghost commented May 25, 2017

True, but that would be hard to detect. getSymbolScope definitely isn't looking for that right now.

@sandersn
Copy link
Member

OK, that's what I needed to know. I wasn't sure of getSymbolScope's purpose.

@mhegazy
Copy link
Contributor

mhegazy commented May 25, 2017

getSymbolScope is just an optimization, so we only want to use it if we are sure the symbol will never escape this scope; otherwise we fall back to our normal exhaustive search. so it is ok for it to not handle all patterns.

@ghost ghost merged commit 2ceb350 into master May 25, 2017
@ghost ghost deleted the mappedTypeDeclarations branch May 25, 2017 16:43
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants