-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Input Code
example = <Example style="""
color: blue;
""" />Same applies to
example = <Example style='''
color: blue;
''' />
This only happens when there's no string interpolation. The following compiles as expected:
example = <Example style="""
color: #{color};
""" />Expected Behavior
Compiler additionally wraps the string in curlies:
var example;
example = <Example style={`color: blue;`} />;Current Behavior
#babel (terrible error message btw)
JSX value should be either an expression or a quoted JSX text (3:25)
1 | var example;
2 |
> 3 | example = <Example style=`color: blue;` />;
| ^
4 |
Possible Solution
Either give an explicit compile error or support the users' stupidity.
I suspect that the compiler currently checks if there are any interpolations instead of checking which quotes apply. Could be this was introduced when tripple-double-quotes (and tripple-single-quotes) output was changed to output as multi-line string literals.
Context
Gave me a compile error later in the toolchain than necessary.
Seeing as the workaround is so easy (using curlies or single double-quotes) i consider this quite low priority.
Environment
- CoffeeScript: v2.5.1
- Node.js: v14.16.1
- Babel: v6.23.0
- "@babel/plugin-transform-react-jsx": "7.13.12"
Metadata
Metadata
Assignees
Labels
No labels