Skip to content

[ts] Allow ...<...> followed by newline or binary operator#14636

Merged
nicolo-ribaudo merged 1 commit intobabel:mainfrom
nicolo-ribaudo:ts-inst-expr-kw-nl
Jun 16, 2022
Merged

[ts] Allow ...<...> followed by newline or binary operator#14636
nicolo-ribaudo merged 1 commit intobabel:mainfrom
nicolo-ribaudo:ts-inst-expr-kw-nl

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo commented Jun 2, 2022

Q                       A
Fixed Issues? Ref microsoft/TypeScript#49353
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

I'm marking this PR as a draft until the TS PR is merged with the final syntax rules.

@nicolo-ribaudo nicolo-ribaudo added PR: Spec Compliance 👓 A type of pull request used for our changelog categories pkg: parser area: typescript labels 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.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The linked issue has been fixed.

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Jun 2, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52199/

@nicolo-ribaudo nicolo-ribaudo changed the title [ts] Allow ...<...> followed by newline and strict keyword [ts] Allow ...<...> followed by newline or binary operator Jun 10, 2022
// a<b>c is (a<b)>c
(tokenType !== tt.parenL &&
tokenCanStartExpression(tokenType) &&
!this.hasPrecedingLineBreak())
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@@ -9,36 +9,40 @@
"body": [
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure if these changes are correct; I asked to the TS team.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@nicolo-ribaudo nicolo-ribaudo marked this pull request as ready for review June 11, 2022 13:32
@nicolo-ribaudo nicolo-ribaudo merged commit 2ca44e4 into babel:main Jun 16, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the ts-inst-expr-kw-nl branch June 16, 2022 07:19
nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Jun 18, 2022
@JLHwung JLHwung mentioned this pull request Jul 21, 2022
1 task
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Sep 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Spec Compliance 👓 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants