Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Leading underscore not trimmed in object keys #328

Closed
azz opened this issue Jun 14, 2017 · 4 comments · Fixed by #330
Closed

Leading underscore not trimmed in object keys #328

azz opened this issue Jun 14, 2017 · 4 comments · Fixed by #330
Labels

Comments

@azz
Copy link
Contributor

azz commented Jun 14, 2017

Forwarding from prettier/prettier#2143.

Input:

obj = {                                                                               
  '__': 42 
}

Output:

obj = {                                                                               
  '___': 42 
}

Looks the same as #296

@soda0289
Copy link
Member

Thanks for the report. I wonder if there are any other places this happens. Pretty much anywhere we have an identifier, that's not an identifier node type, we need to escape the value.

@soda0289 soda0289 added bug and removed triage labels Jun 15, 2017
@azz
Copy link
Contributor Author

azz commented Jun 15, 2017

Curious why TS needs to "escape" it in the first place?

@JamesHenry
Copy link
Member

@azz This is the original issue we reported to them microsoft/TypeScript#14013, you can see their response on there

@azz
Copy link
Contributor Author

azz commented Jun 15, 2017

Thanks! Seems like it could have been avoided with a good old hasOwnProperty check or Object.create(null)? 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants