Skip to content

Treat NoSubstitutionTemplateLiteral same as a StringLiteral in import statement #29318

@ericbf

Description

@ericbf

TypeScript Version: 3.2

Search Terms: NoSubstitutionTemplateLiteral, import template literal

Code

import * as ts from `typescript`

Expected behavior:

No error, as the NoSubstitutionTemplateLiteral should be treated just as a StringLiteral. Or potentially cannot find module error, depending on whether the module is installed.

Actual behavior:

Throws the error: "String literal expected"

Playground Link:
playground link

Related Issues:
This idea was touched on by #17704, but I guess this use case slipped through the cracks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Out of ScopeThis idea sits outside of the TypeScript language design constraintsRevisitAn issue worth coming back toSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions