Skip to content

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Aug 7, 2025

Q                       A
License MIT

In this PR we improved the typings of @babel/core: For every functional properties in InputOptions and PluginObject, it is now annotated with specific signatures. We also fixed incorrect typings in the loadOptions API.

We also added a new typing export for @babel/traverse: VisitWrapper, used by the InputOptions#wrapPluginVisitorMethod. There is no new typing export from @babel/core though.

Also specified terser as devDependency since it is required by the @babel/helpers build scripts.

@JLHwung JLHwung added the PR: Polish (next major) 💅 A type of pull request used for our changelog categories for next major release label Aug 7, 2025
sourceMaps,

// babel-generator does not differentiate between `true`, `"inline"` or `"both"`
sourceMaps: !!sourceMaps,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we cast generatorOpts.sourceMaps to boolean as required by the @babel/generator.

@JLHwung JLHwung marked this pull request as draft August 7, 2025 17:42
@JLHwung JLHwung force-pushed the improve-babel-core-typings branch from 383d697 to 50a8795 Compare August 7, 2025 18:51
@babel-bot
Copy link
Collaborator

babel-bot commented Aug 7, 2025

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

@JLHwung JLHwung marked this pull request as ready for review August 7, 2025 18:56
"private": true,
"type": "module",
"devDependencies": {
"$repo-utils": "link:../scripts/repo-utils",
Copy link
Contributor Author

@JLHwung JLHwung Aug 7, 2025

Choose a reason for hiding this comment

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

This is a private package and will probably never be published, so we simply add $repo-utils here.

parserOpts?: ParserOptions;
// Deprecate top level generatorOpts
// Todo(Babel 9): Deprecate top level generatorOpts
generatorOpts?: GeneratorOptions;
Copy link
Contributor Author

@JLHwung JLHwung Aug 7, 2025

Choose a reason for hiding this comment

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

The todo items have been here since 8 years ago, but I am not sure if we want to do it in Babel 8.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 7, 2025

Open in StackBlitz

commit: a80e2d8

@JLHwung JLHwung force-pushed the improve-babel-core-typings branch from 6d4abc9 to 4b8fe00 Compare August 12, 2025 02:12
@JLHwung JLHwung force-pushed the improve-babel-core-typings branch from 4b8fe00 to a80e2d8 Compare August 19, 2025 18:46
@JLHwung JLHwung merged commit 18d88b8 into babel:main Aug 22, 2025
76 checks passed
@JLHwung JLHwung deleted the improve-babel-core-typings branch August 22, 2025 00:08
@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 Nov 21, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Polish (next major) 💅 A type of pull request used for our changelog categories for next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants