A wrong (and now fixed) code in our app triggered this error :
TypeError: Cannot create property 'FOO' on string 'BAR'
But Javascript completely allows setting free properties on a string variable. I just tried it in Chrome console :
'BAR'.FOO = 'hello'
'BAR'['FOO'] = 'hello'
And it works perfectly.
So in which context do the JS interpreter trigger this error ?
The original code is written in Typescript, then transpiled with Babel. This is a runtime error. I assume this is not related to typescript since other people report a similar runtime error, ex. here and here
So in which context do the JS interpreter trigger this error ?
Strict mode.
'use strict';
'BAR'.FOO = 'test';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With