Skip to content

Conversation

@rbuckton
Copy link
Contributor

@rbuckton rbuckton commented Sep 9, 2016

We parse the missing element as an OmittedExpression but cast it to a BindingElement even though it does not have the same shape. The result was an issue where the module transformer did not account for this case and code like the following would result in an exception:

const [a, , b] = [1, 2, 3];
export { a, b };

This PR makes the expected types more explicit and fixes the incorrect case.

Fixes #10778

export function isArrayBindingElement(node: Node): node is ArrayBindingElement {
const kind = node.kind;
return kind === SyntaxKind.BindingElement
|| kind === SyntaxKind.OmittedExpression;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kind of weird that a binding element uses an omitted expression

@DanielRosenwasser
Copy link
Member

Looks good to me 👍

@rbuckton rbuckton merged commit 6b25dab into master Sep 9, 2016
@rbuckton rbuckton deleted the fix10778 branch September 9, 2016 02:49
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly error

4 participants