Tagged template literals
A tagged template allows you to process a template literal with a function.
The function receives the string, along with any embedded expressions, as arguments.
Loading TypeScript...
The first argument is an array of strings with each fragment of literal text from the template. The type
of this argument is TemplateStringsArray
, and not string[]
.
The subsequent arguments are the values to insert between the literal text fragments.
Loading TypeScript...
You can also use a function generator to produce a tagging function.
Loading TypeScript...