question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template literals are unsupported for nested calls

See original GitHub issue

Issuehunt badges

The 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 toonijn has been rewarded.

Backers (Total: $40.00)

Submitted pull Requests


Tips

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
sindresorhuscommented, Jul 12, 2019

I agree, would be better to actually support that.

1reaction
Qix-commented, Apr 1, 2020

without performance hit

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found