Skip to content

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

Merged
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:single-quoted-specifiers-lol
Jul 3, 2018
Merged

Change import type determination to not use a RE on the symbol name#25381
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:single-quoted-specifiers-lol

Conversation

@weswigham
Copy link
Copy Markdown
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
Copy Markdown

jrf0110 commented Jul 3, 2018

Damn you guys are awesome. Thanks! ❤️

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
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