Skip to content

Permit using template strings for string literal types #29331

@ericbf

Description

@ericbf

TypeScript Version: 3.2

Search Terms: NoSubstitutionTemplateLiteral, generic parameter, string type, string literal type

Code

const x: Promise<`hi`>

Expected behavior:

No error.

Actual behavior:

There are errors as it doesn't accept the string literal as a type param for the generic class.

Playground Link: link

Related Issues:
This idea was touched on by #17704, but this use case was missed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions