Skip to content

Change import type determination to not use a RE on the symbol name #25381

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
merged 1 commit into from
Jul 3, 2018

Conversation

weswigham
Copy link
Member

@weswigham weswigham commented Jul 2, 2018

Fixes #25278

So as it turns out, at using getNameOfSymbolAsWritten, which itself defers to declarationNameToString, which uses the verbatim original text of a module declaration's name and not the symbol's name (unless it has no node-based name) was an error. This meant ambient modules would be surrounded with single quotes if the original declaration used a single quoted string, rather than the double quotes we ensure we use internally (and therefore what we expect to match in ambientModuleSymbolRegex).

I've now changed symbolToTypeNode to use a much less brittle check for hasNonGlobalAugmentationExternalModuleSymbol on the symbol's declarations, and while I was at it, factored the module specifier parts out of getNameOfSymbolAsWritten (and reordered it so control flow worked better on it), since that's really not what getNameOfSymbolAsWritten is for.

@weswigham weswigham merged commit 65655f2 into microsoft:master Jul 3, 2018
@weswigham weswigham deleted the single-quoted-specifiers-lol branch July 3, 2018 00:43
@jrf0110
Copy link

jrf0110 commented Jul 3, 2018

Damn you guys are awesome. Thanks! ❤️

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.

3 participants