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

[typescript] parsing template literal as type #9748

Merged

Conversation

@tanhauhau
Copy link
Member

commented Mar 22, 2019

Q                       A
Fixed Issues? Fixes #9706
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Mar 22, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10593/

node.literal = this.finishNode(
noSubstitutionTemplateLiteralNode,
"NoSubstitutionTemplateLiteral",
);

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Mar 23, 2019

Member

I don't see why we need a new node type here. We can just re-use TemplateLiteral: if node.expressions.length === 0, then it doesn't have any substitution.

"NoSubstitutionTemplateLiteral",
);
} else {
throw this.unexpected(startPosition);

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Mar 23, 2019

Member
Suggested change
throw this.unexpected(startPosition);
throw this.raise(templateNode.expressions[0].start, "Template literal types cannot have any substitution");
tanhauhau added 2 commits Mar 24, 2019

@nicolo-ribaudo nicolo-ribaudo merged commit 2867bbf into babel:master Mar 25, 2019

5 checks passed

babel/repl REPL preview is available
Details
buildsize No significant change
Details
ci/circleci Your tests passed on CircleCI!
Details
codecov/project 87.27% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Mar 25, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.