-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not wrap keys in unnecessary quotes when using ES2016 #4106
Comments
It looks like the specific character here is The JavaScript language standard doesn't require a specific version of Unicode other than saying the following:
It also contains the following footnote:
That makes the Unicode version support matrix look roughly like this:
So you're right that technically a target of ES2016 means that anything consuming It's hard to commit to emitting JavaScript that is guaranteed to be parsed successfully by all of the various JavaScript processing tools in the ecosystem without quoting things conservatively. The approach that esbuild uses is to parse all identifiers that are/were considered to be valid identifiers in any past version of ECMAScript, but to quote identifiers that aren't considered to be a valid identifier in all past versions of ECMAScript. So esbuild naturally works with all JavaScript input, and esbuild's JavaScript output naturally works with everything else. You can read more about the details of esbuild's approach here. I personally like the conceptual simplicity of this approach and would be very hesitant to change it as I imagine it could easily break interoperability with the ecosystem in hard-to-anticipate ways. Any change to this would have to be carefully considered and would need to come with a lot of research into compatibility with other tools and engines (including past versions). And all of that doesn't seem worth it to save on generating a few quotation marks. So I'm not inclined to do this. |
When I have an object with valid unicode keys, sometimes the characters get quoted.
I have e.g. the following object:
When I build it with esbuild specifying the
tsconfig.json
file withtarget: 'esnext'
and the--charset=utf8
option, it is transformed toIs there a way to get rid of these unnecessary quotes?
The text was updated successfully, but these errors were encountered: