Template literals are unsupported for nested calls
See original GitHub issueThe following is unsupported despite it being allowed by the type system:
chalk.bold`Hello, {cyan.inverse ${name}!} This is a test. {green ${exclamation}!}`;
Produces:
Hello, {cyan.inverse ,!} This is a test. {green ,!} Sindre Neat
Instead of:
Hello, Sindre! This is a test. Neat!
IssueHunt Summary
toonijn has been rewarded.
Backers (Total: $40.00)
- issuehunt ($40.00)
Submitted pull Requests
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >Nested Template Strings/Literals Error: Missing - Stack Overflow
I am trying to make a nav bar using information pulled from the DOM, but I keep getting an error associated ES6 template...
Read more >How you can use styled-components without template literals
Calling logArgs using a tagged template literal, on the other hand, logs an array. This is our first lesson: Tagged template literals pass...
Read more >bug #50920: support Javascript template strings in xgettext
Yes, it looks like template strings can be nested, ... However, Javascript's interpolated strings are not supported in xgettext at all, ...
Read more >Bringing JSX to Template Literals | by Andrea Giammarchi
The template would contain all the static parts of the literal, while zero, one, or more values would be what we call interpolated...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree, would be better to actually support that.
You cannot possibly assert this. There is no special function invocation for template literals aside from different argument types, so you’d have to do a branch (an
if
statement) in order to determine if you’re being called as a literal.Branches are very much overhead, and can be quite detrimental in tight loops if gone unchecked.