-
Notifications
You must be signed in to change notification settings - Fork 13k
Disallow reserved words for object binding pattern names #2809
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
Conversation
👍 |
let id = parsePropertyName(); | ||
if (id.kind === SyntaxKind.Identifier && token !== SyntaxKind.ColonToken) { | ||
node.name = <Identifier>id; | ||
let tokenIsIdentifier = isIdentifier(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we decide to not just always parse out a property name, and then error later if the property name turns out to be a keyword?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is another approach we are considering. I do prefer it
Looks like we get this wrong for import / export specifiers as well! I tried the following: interface StringTree { }
export { StringTree as while }; I got no error. |
… always an Identifier.
c1d11cf
to
4134d79
Compare
Disallow reserved words for object binding pattern names
Fixes #2722.