-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Typescript function destructured params #9431
Typescript function destructured params #9431
Conversation
mhcgrq
commented
Jan 30, 2019
Q | A |
---|---|
Fixed Issues? | Fixes #9430 |
Patch: Bug Fix? | Yes |
Major: Breaking Change? | |
Minor: New Feature? | |
Tests Added + Pass? | Yes |
Documentation PR Link | |
Any Dependency Changes? | |
License | MIT |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9960/ |
@@ -794,6 +795,21 @@ export default (superClass: Class<Parser>): Class<Parser> => | |||
return true; | |||
} | |||
|
|||
if (this.match(tt.bracketL)) { |
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.
The two checks should be merged, since there could be code like this:
type Foo = ([{a}]: any) => {};
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.
Currently it just works for [a]
{a}
and [{a}]
. Is that neccesary to check brace and bracket within a same if block? Since there is only brace and bracket, no more conditions.
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.
I understood why this already works
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.
lgtm
@@ -794,6 +795,21 @@ export default (superClass: Class<Parser>): Class<Parser> => | |||
return true; | |||
} | |||
|
|||
if (this.match(tt.bracketL)) { |
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.
I understood why this already works