Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
You can use template literals as object keys.
I don't know what error you got, but chances are, an interpolation in your template literal is wrong, or the resulting data doesn't play nice as an object key. -
@homo-lorens Don't confuse TypeScript with javascript. They're not the same thing.
-
@homo-lorens That's not a correct syntax, AFAIK; it should have the [] encapsulating the dynamic key.
And why would you use backticks if you're not interpolating anything?
Related Rants
JS has
dynamic object literal keys
String object literal keys
Why aren't template literal keys allowed, and _why_ isn't there a proper error message for them?
rant
js
object key
template literal