-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
feat(js_parser): better diagnostic for infer type #243 #308
Merged
+8,307
−224
Conversation
This file contains 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
denbezrukov
temporarily deployed
to
Website deployment
September 16, 2023 21:45 — with
GitHub Actions
Inactive
github-actions
bot
added
A-Parser
Area: parser
A-Formatter
Area: formatter
A-Website
Area: website
L-JavaScript
Language: JavaScript and super languages
A-Changelog
Area: changelog
labels
Sep 16, 2023
denbezrukov
force-pushed
the
feat/ts-infer
branch
from
September 16, 2023 21:46
366b00a
to
2e1b442
Compare
denbezrukov
temporarily deployed
to
Website deployment
September 16, 2023 21:48 — with
GitHub Actions
Inactive
denbezrukov
force-pushed
the
feat/ts-infer
branch
from
September 16, 2023 21:50
2e1b442
to
f80b3b8
Compare
denbezrukov
temporarily deployed
to
Website deployment
September 16, 2023 21:50 — with
GitHub Actions
Inactive
denbezrukov
force-pushed
the
feat/ts-infer
branch
from
September 17, 2023 15:30
f80b3b8
to
318bf44
Compare
denbezrukov
temporarily deployed
to
Website deployment
September 17, 2023 15:30 — with
GitHub Actions
Inactive
!bench_parser |
denbezrukov
force-pushed
the
feat/ts-infer
branch
from
September 17, 2023 16:19
318bf44
to
018703e
Compare
denbezrukov
temporarily deployed
to
Website deployment
September 17, 2023 16:19 — with
GitHub Actions
Inactive
Parser Benchmark Results
|
denbezrukov
force-pushed
the
feat/ts-infer
branch
from
September 17, 2023 16:55
018703e
to
fac7d7a
Compare
denbezrukov
temporarily deployed
to
Website deployment
September 17, 2023 16:55 — with
GitHub Actions
Inactive
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
🔥 Regression (2):
ts/microsoft
🎉 Fixed (2):
|
denbezrukov
force-pushed
the
feat/ts-infer
branch
from
September 17, 2023 17:46
fac7d7a
to
7730d41
Compare
denbezrukov
temporarily deployed
to
Website deployment
September 17, 2023 17:46 — with
GitHub Actions
Inactive
Regressions are expected:
They have the following code which has a invalid
|
nissy-dev
approved these changes
Sep 18, 2023
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.
Thank you for making parser behavior stricter!
denbezrukov
force-pushed
the
feat/ts-infer
branch
from
September 18, 2023 08:19
7730d41
to
931c981
Compare
denbezrukov
temporarily deployed
to
Website deployment
September 18, 2023 08:19 — with
GitHub Actions
Inactive
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Changelog
Area: changelog
A-Formatter
Area: formatter
A-Parser
Area: parser
A-Website
Area: website
L-JavaScript
Language: JavaScript and super languages
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.
Summary
The 'infer' keyword can only be utilized within the 'extends' clause of a conditional type. Using it outside of this context will result in an error. Ensure that any type declarations using 'infer' are correctly placed within the conditional type structure to avoid parsing issues.
Added an error message from the typescript for such cases:
'infer' declarations are only permitted in the 'extends' clause of a conditional type.
Took test cases from the ts repo:
https://github.com/microsoft/TypeScript/blob/9cbcf010ce0701a25f01a2a074000db34f80cc17/tests/baselines/reference/inferTypes1.errors.txt#L124
https://github.com/microsoft/TypeScript/blob/9cbcf010ce0701a25f01a2a074000db34f80cc17/tests/baselines/reference/templateLiteralTypes1.errors.txt#L5
Test Plan
cargo test