Skip to content
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

Fixed the ParseResult type in @babel/core #14333

Merged
merged 1 commit into from
Mar 5, 2022

Conversation

Andarist
Copy link
Member

@Andarist Andarist commented Mar 4, 2022

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

Those types IMHO should be consistent since @babel/core just~ calls to @babel/parser here.

type AstRoot = t.File | t.Program;

export type ParseResult = AstRoot;
export type ParseResult = ReturnType<typeof parse>;
Copy link
Member Author

Choose a reason for hiding this comment

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

this represents something like:

type ParseResult = File & {
    errors: ParseError[];
}

@babel-bot
Copy link
Collaborator

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

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

Note that @babel/core types are not published, so if you are using them they may come from DefinitelyTyped.

@Andarist
Copy link
Member Author

Andarist commented Mar 5, 2022

That might be right - should I also prepare a PR to the DefinitelyTyped then?

@nicolo-ribaudo
Copy link
Member

Yes please! (even if we don't maintain those type definitions)

@Andarist
Copy link
Member Author

Andarist commented Mar 5, 2022

I've created a corresponding PR to DefinitelyTyped: DefinitelyTyped/DefinitelyTyped#59153

@nicolo-ribaudo nicolo-ribaudo merged commit 5cf3118 into babel:main Mar 5, 2022
@Andarist Andarist deleted the fix/core-parse-res-type branch March 18, 2022 21:07
@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 Jun 18, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants