fix: provide legacy typings for TS < 4.1#16638
Merged
JLHwung merged 1 commit intobabel:mainfrom Jul 12, 2024
Merged
Conversation
nicolo-ribaudo
approved these changes
Jul 12, 2024
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/57334 |
liuxingbaoyu
approved these changes
Jul 12, 2024
Contributor
Author
|
When I paste https://unpkg.com/@babel/types@7.24.8/lib/index-legacy.d.ts into TypeScript playground with TS 3.6.3, there are parser errors for // Function implementation is missing or not immediately following the declaration.
export function booleanLiteralTypeAnnotation(value: boolean): BooleanLiteralTypeAnnotation;Same errors with 3.7 or 4.0 I think we should add a test job for legacy typings. |
Member
|
I get no errors -- did you set the language to "TypeScrpt Declaration"? |
Contributor
Author
Indeed, thanks! Merging it as-is. |
Contributor
FWIW, Jest uses |
This was referenced Aug 5, 2024
This was referenced Oct 4, 2024
Open
This was referenced Oct 5, 2024
Open
Open
This was referenced Oct 5, 2024
This was referenced Oct 8, 2024
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.
In #16570 we improved the typings for
getBindingIdentifiersvia Key Remapping in Mapped Types, which is a TypeScript 4.1 feature. Note that TypeScript 4.1 was released in November 2020 (almost 4 years ago).As we already provide legacy typings for TS < 3.7, here we bump the legacy typing condition to TS < 4.1. Hopefully this should address the @babel/types type check errors on TS < 4.1.