[ts] Allow ...<...> followed by newline or binary operator#14636
Merged
nicolo-ribaudo merged 1 commit intobabel:mainfrom Jun 16, 2022
Merged
[ts] Allow ...<...> followed by newline or binary operator#14636nicolo-ribaudo merged 1 commit intobabel:mainfrom
...<...> followed by newline or binary operator#14636nicolo-ribaudo merged 1 commit intobabel:mainfrom
Conversation
nicolo-ribaudo
commented
Jun 2, 2022
| // a<b> | ||
| // if (0); | ||
| // is not valid TS code (https://github.com/microsoft/TypeScript/issues/48654) | ||
| // However, it should correctly parse anything that is correctly parsed by TS. |
Member
Author
There was a problem hiding this comment.
The linked issue has been fixed.
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52199/ |
...<...> followed by newline and strict keyword...<...> followed by newline or binary operator
177201b to
2d85950
Compare
2d85950 to
c5b12b3
Compare
nicolo-ribaudo
commented
Jun 10, 2022
| // a<b>c is (a<b)>c | ||
| (tokenType !== tt.parenL && | ||
| tokenCanStartExpression(tokenType) && | ||
| !this.hasPrecedingLineBreak()) |
Member
Author
There was a problem hiding this comment.
We also have this test (still passing) which is relevant: https://github.com/babel/babel/tree/main/packages/babel-parser/test/fixtures/typescript/type-arguments/call-newline
nicolo-ribaudo
commented
Jun 10, 2022
| @@ -9,36 +9,40 @@ | |||
| "body": [ | |||
Member
Author
There was a problem hiding this comment.
I'm not sure if these changes are correct; I asked to the TS team.
Member
Author
There was a problem hiding this comment.
Yes, the updates are correct: https://www.typescriptlang.org/play?ts=4.8.0-dev.20220611#code%2FHYUw7gBAggPAQgPgFAGEg=
I'll rename the test.
liuxingbaoyu
approved these changes
Jun 14, 2022
existentialism
approved these changes
Jun 15, 2022
JLHwung
approved these changes
Jun 15, 2022
nicolo-ribaudo
added a commit
to nicolo-ribaudo/babel
that referenced
this pull request
Jun 18, 2022
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm marking this PR as a draft until the TS PR is merged with the final syntax rules.