Skip to content

The type of String.raw is too restrictive #43609

@elibarzilay

Description

@elibarzilay

Bug Report

The first argument of String.raw is typed as TemplateStringsArray: this is fine when it is used as a tag function, but it is also useful on its own -- for example, calling it directly from your own tag function to do the job of interleaving strings and values as well as converting these values to strings. For such uses, it is convenient to call it with just { raw: [...] }, since that is the only needed bit in the spec, and this can also be seen in several of the MDN examples.

So it should only require the raw property to enable such uses.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions