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

Disambiguate string literal types from other string literals. #5725

Merged
merged 2 commits into from
Nov 24, 2015

Conversation

rbuckton
Copy link
Member

Additional type cleanup, partially based on this suggestion: #5719 (comment).

Also splits off template literal fragments into a separate type that is not LiteralExpression.

Supports #5595.

@@ -4531,7 +4531,7 @@ namespace ts {
return links.resolvedType;
}

function getStringLiteralType(node: StringLiteral): StringLiteralType {
function getStringLiteralType(node: StringLiteral | StringLiteralTypeNode): StringLiteralType {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should just take the string and call it getStringLiteralTypeForText; what are your thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

No need to change the name, I can just change the argument to be a string.

@DanielRosenwasser
Copy link
Member

Can you add those two examples we talked about that caused crashes?

@rbuckton
Copy link
Member Author

@DanielRosenwasser Were you talking about the Debug.assert when combining a this type with --emitDecoratorMetadata? I can add a test for that in a separate PR, as it doesn't apply to this work.

What was the other example?

@DanielRosenwasser
Copy link
Member

I don't remember either. Let that be a lesson to both of us. 😞

Otherwise 👍

rbuckton added a commit that referenced this pull request Nov 24, 2015
Disambiguate string literal types from other string literals.
@rbuckton rbuckton merged commit 8909c3a into master Nov 24, 2015
@rbuckton rbuckton deleted the stringTypesCleanup branch November 24, 2015 23:23
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants