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.

`ts-styled-plugin` error on valid syntax with 2 interpolation strings

See original GitHub issue

The error occurs in this code in a css prop:

${this.props.whichSide}: ${this.state.isActive ? 0 : '-90vw' };

It looks kinda weird, but it’s for a sidebar component that can be either left or right (this.props.whichSide). This code works and results in left/right: 0/-90vw; to conditionally activate/deactivate the sidebar on the left/right.

The only problem is that the vscode plugin gives an error on the first $ sign: } expected ts-styled-plugin(9999) and later on closing the css prop with `}>: at-rule or selector expected ts-styled-plugin(9999)

There seem to be a plethora of issues with similar, rather uncommon use cases of string interpolation. Many also in the typescript plugin (which, as I understand it, is used by this plugin):
microsoft/typescript-styled-plugin#71, microsoft/typescript-styled-plugin#74, microsoft/typescript-styled-plugin#88 and microsoft/typescript-styled-plugin#89. (I’m not using typescript, so I don’t understand why I’m getting the typescript ts-styled-plugin error.)

Is this being addressed? Even a stopgap solution like an // eslint-disable-next-line would be helpful, does that exist?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
sumbadcommented, Jan 25, 2020

@breadadams, unfortunately, a set of curly brackets doesn’t fix the error. Additionally, I’ve gotten a new error: image

I use lit-html.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting an "invalid syntax" when trying to perform string ...
I have recently been learning python 3 and I cannot get any examples involving string interpolation (formatting) to work.
Read more >
Template Strings, String interpolation & multi-line Typescript
In this tutorial, we will learn the Template strings (or Literals) syntax and how to use it in Multiline Strings & string interpolation....
Read more >
String interpolation in python - coursera.support
I am getting an syntax error in the line where fstrings is used. Please share your thoughts to fix this issue.
Read more >
Python 3 SyntaxError: invalid syntax f strings - Softhints
I was working on a old python project and I got error: filename = f. ... proposed to add a new string formatting...
Read more >
String concatenation vs string interpolation in Python
Wondering how to concatenate a string in Python? Hold on! There are two ways to build up bigger strings out of smaller strings:...
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