Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 12, 2024

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

In #16570 we improved the typings for getBindingIdentifiers via 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.

@JLHwung JLHwung added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jul 12, 2024
@babel-bot
Copy link
Collaborator

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

@JLHwung
Copy link
Contributor Author

JLHwung commented Jul 12, 2024

When I paste https://unpkg.com/@babel/[email protected]/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.

@nicolo-ribaudo
Copy link
Member

I get no errors -- did you set the language to "TypeScrpt Declaration"?

@JLHwung
Copy link
Contributor Author

JLHwung commented Jul 12, 2024

I get no errors -- did you set the language to "TypeScrpt Declaration"?

Indeed, thanks! Merging it as-is.

@JLHwung JLHwung merged commit de47960 into babel:main Jul 12, 2024
@JLHwung JLHwung deleted the provide-legacy-typings-for-ts-lte-40 branch July 12, 2024 16:12
@SimenB
Copy link
Contributor

SimenB commented Jul 15, 2024

I think we should add a test job for legacy typings.

FWIW, Jest uses tstyche which has good support for type tests using different versions of TS. Dunno if you actually wanna test your types or just ensure they compile, tho

@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 Oct 15, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: types 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.

[Bug]: @babel/types TypeScript error after v7.24.8 publication

5 participants