You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The concatenation is used as a key in a Map, and the property name is concatenated with a boolean, so it could be possible to use two maps instead of one (one map for the static members, one for the non-static members) directly keyed by the property name (either a string or a symbol)
Additional context
I encountered this while migrating a Lit element from static properties to using decorators through Babel; with static properties I couldn't use a private property (as the property from the static properties object value has to match a property in the enclosing class) so I had used a symbol (I could also have used any mangled, non-conflicting, name); I could migrate to using a private property with decorators but unfortunately Lit decorators don't seem to work with those, so in the mean time I can use a non-conflicting name (e.g. _-prefixed), so at least I have a workaround.
The text was updated successfully, but these errors were encountered:
Hey @tbroyer! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.
馃捇
How are you using Babel?
@babel/cli
Input code
REPL
Try commenting out each property.
Configuration file name
No response
Configuration
No response
Current and expected behavior
Generated code throws error
Cannot convert a Symbol value to a string
at linebabel/packages/babel-helpers/src/helpers/applyDecs2305.ts
Line 499 in bf3d314
Environment
System:
OS: Linux 6.7 Arch Linux
Binaries:
Node: 20.11.1 - /usr/bin/node
Yarn: 1.22.21 - /usr/bin/yarn
npm: 10.4.0 - /usr/bin/npm
pnpm: 8.6.0 - /usr/bin/pnpm
Possible solution
The concatenation is used as a key in a
Map
, and the property name is concatenated with a boolean, so it could be possible to use two maps instead of one (one map for the static members, one for the non-static members) directly keyed by the property name (either a string or a symbol)Additional context
I encountered this while migrating a Lit element from
static properties
to using decorators through Babel; withstatic properties
I couldn't use a private property (as the property from thestatic properties
object value has to match a property in the enclosing class) so I had used a symbol (I could also have used any mangled, non-conflicting, name); I could migrate to using a private property with decorators but unfortunately Lit decorators don't seem to work with those, so in the mean time I can use a non-conflicting name (e.g._
-prefixed), so at least I have a workaround.The text was updated successfully, but these errors were encountered: