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

Allow template strings (with no interpolated expressions) to start off with literal types #16592

Closed
DanielRosenwasser opened this issue Jun 16, 2017 · 2 comments
Labels
Bug A bug in TypeScript Domain: Literal Types Unit types including string literal types, numeric literal types, Boolean literals, null, undefined Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jun 16, 2017

I can't find the original issue (if there is one).

const c: "hello" = `hello`

Expected: No error.
Actual: Type 'string' is not assignable to type '"hello"'.

We should just allow people to use NoSubstitutionTemplates the way that they're allowed to use regular strings.

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Literal Types Unit types including string literal types, numeric literal types, Boolean literals, null, undefined Suggestion An idea for TypeScript and removed Bug A bug in TypeScript labels Jun 16, 2017
@ericbf
Copy link
Contributor

ericbf commented Sep 5, 2017

This should also cover using NoSubstitutionTemplates as literal types as in #18109

@ericbf
Copy link
Contributor

ericbf commented Sep 13, 2017

Is there any progress being made on this?

@andy-ms the PR that referenced this issue didn't completely resolve the cases covered by using NoSubstitutionTemplates as literal types.

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this Bug A bug in TypeScript and removed Suggestion An idea for TypeScript labels Sep 13, 2017
@ghost ghost closed this as completed in #18452 Sep 14, 2017
@ghost ghost added Fixed A PR has been merged for this issue and removed Help Wanted You can do this labels Sep 14, 2017
@mhegazy mhegazy added this to the TypeScript 2.6 milestone Sep 14, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: Literal Types Unit types including string literal types, numeric literal types, Boolean literals, null, undefined Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants