Fix generator missing parens around an arrow returning function type#10519
Fix generator missing parens around an arrow returning function type#10519
Conversation
existentialism
commented
Oct 2, 2019
| Q | A |
|---|---|
| Fixed Issues? | Fixes #10517 |
| Patch: Bug Fix? | Y |
| Major: Breaking Change? | N |
| Minor: New Feature? | N |
| Tests Added + Pass? | Yes |
| Documentation PR Link | |
| Any Dependency Changes? | |
| License | MIT |
fd85e40 to
12d2aa4
Compare
| t.isArrayTypeAnnotation(parent) || | ||
| // <T>(A: T): (T => T[]) => B => [A, B] | ||
| (t.isTypeAnnotation(parent) && | ||
| t.isArrowFunctionExpression(printStack[printStack.length - 3])) |
There was a problem hiding this comment.
What does printStack[printStack.length - 3]...... mean?
I assume this is related to Flow emit; the example syntax looks like invalid TypeScript.
Also, would the structure be the same if <T>(A: T): // ... (declaration signature) was written as <T>(A: T) => /... (expression signature)?
There was a problem hiding this comment.
Yeah, it's Flow emit related. I can add a comment, the printStack bit is just checking the grandparent (since these are only passed node, its parent, and the whole stack).
| const bar7 = <T>(x) => {}; No newline at end of file | ||
| const bar7 = <T>(x) => {}; | ||
|
|
||
| const bar8 = <T>(x: T): ((T) => T[]) => y => [x, y]; |
There was a problem hiding this comment.
hmm, I see. Maybe the correct output should be the one in the code comment.
There was a problem hiding this comment.
I was look into dropping the parens around (T) later, initial experiment looked like it touched a bunch of other fixtures.
12d2aa4 to
4868549
Compare