-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Allow trailing commas after non-rest elements in destructuring #24672
Conversation
thanks @bakkot! |
Will this be in 2.9.3 ? |
No. TS 3.0, should be out next week. |
This problem still exists in the 3.0.1 |
@jerome The example from #24628 works for me with |
@Andy-MS in React component import React, { PureComponent } from 'react';
export interface ButtonProps {
size?: 'large' | 'normal' | 'small';
}
export default class Button extends PureComponent<ButtonProps, {}> {
render() {
const {
size,
children,
...others, // error line
} = this.props;
return <a {...others}>{children}</a>;
}
} |
@JeromeLin, that's not syntactically valid JavaScript or (as of #22262) TypeScript. You can't have a trailing comma after a rest element ( TypeScript's behavior is correct; you should remove that comma. |
@bakkot thanks. this problem has been solved. |
Fixes #24628.
cc @Andy-MS for the original change in #22262.