Skip to content

Conversation

elibarzilay
Copy link
Contributor

The String.raw spec uses just
the raw property of its first argument, which is a useful way of using
it in user-defined tag functions to do the work of interleaving strings
and values as well as converting the values to strings.

Fixes #43609.

The [String.raw spec](https://tc39.es/ecma262/#sec-string.raw) uses just
the `raw` property of its first argument, which is a useful way of using
it in user-defined tag functions to do the work of interleaving strings
and values as well as converting the values to strings.

Fixes microsoft#43609.
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Apr 9, 2021
* @param template A well-formed template string call site representation.
* @param substitutions A set of substitution values.
*/
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
raw(template: { raw: readonly string[] | ArrayLike<string>}, ...substitutions: any[]): string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't necessarily include ArrayLike - I'd keep it simple here personally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanielRosenwasser: I agree that it would be better (like many other places), but I followed what the language is doing

> String.raw({raw: {1: "y", 0: "x", length: 2}}, [3])
"x3y"

@elibarzilay
Copy link
Contributor Author

@DanielRosenwasser: ping

@elibarzilay elibarzilay merged commit 0454ae4 into microsoft:master May 12, 2021
@elibarzilay elibarzilay deleted the fix-string-raw branch May 12, 2021 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

The type of String.raw is too restrictive
3 participants