Skip to content

Add asserts this [is type] parsing support#10677

Merged
existentialism merged 9 commits intobabel:masterfrom
JLHwung:fix-10671
Nov 11, 2019
Merged

Add asserts this [is type] parsing support#10677
existentialism merged 9 commits intobabel:masterfrom
JLHwung:fix-10671

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Nov 7, 2019

Q                       A
Fixed Issues? Fixes #10671
Patch: Bug Fix? Yes, (sort of)
Tests Added + Pass? Yes
License MIT

As a follow-up to #10543, this PR adds asserts this [is type] support. In addition, it also fixes an edge case where asserts keyword contains escaped sequence.

Since we declared TypeScript 3.7 support on 7.7.0, I would expect this PR to be shipped in a patch release.

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser area: typescript labels Nov 7, 2019
@JLHwung JLHwung modified the milestones: v7.7.3, TypeScript 3.7 Nov 7, 2019
nicolo-ribaudo
nicolo-ribaudo previously approved these changes Nov 8, 2019
},
"body": [
{
"type": "TSDeclareMethod",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be wrong

Copy link
Copy Markdown
Contributor Author

@JLHwung JLHwung Nov 8, 2019

Choose a reason for hiding this comment

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

Yeah it is wrong, it should be ClassMethod, in this example the class method is also finished as TSDeclareMethod. I would suggest we address it in a separate PR.

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo Nov 8, 2019

Choose a reason for hiding this comment

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

Well, in that example it's correct because there isn't the method body.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in e6bf63e.

}

const id = this.parseIdentifier();
if (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is refactor of tsParseTypePredicateAsserts which aims to avoid creating node by parseIdentifier.

@nicolo-ribaudo nicolo-ribaudo dismissed their stale review November 9, 2019 11:18

(I have to review this PR again)

@buildsize
Copy link
Copy Markdown

buildsize bot commented Nov 9, 2019

File name Previous Size New Size Change
babel-preset-env.js 2.78 MB 2.78 MB 960 bytes (0%)
babel-preset-env.min.js 1.67 MB 1.67 MB 560 bytes (0%)
babel.js 2.96 MB 2.96 MB 960 bytes (0%)
babel.min.js 1.63 MB 1.63 MB 560 bytes (0%)
test262.tap 4.91 MB [deleted]

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: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript 3.7 syntax: asserts this

3 participants