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

Improve the type definition of path.isX #15661

Merged
merged 4 commits into from Jul 31, 2023
Merged

Improve the type definition of path.isX #15661

merged 4 commits into from Jul 31, 2023

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented May 26, 2023

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

Ref: #15549

@liuxingbaoyu liuxingbaoyu added pkg: traverse PR: Polish 💅 A type of pull request used for our changelog categories area: typescript labels May 26, 2023
@babel-bot
Copy link
Collaborator

babel-bot commented May 26, 2023

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

@@ -201,6 +210,7 @@ export function isForAwaitStatement(this: NodePath): boolean {
return isForOfStatement(this.node, { await: true });
}

// TODO: Remove in Babel 8
export function isExistentialTypeParam(this: NodePath): void {
throw new Error(
"`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.",
Copy link
Member Author

Choose a reason for hiding this comment

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

Let's remove it now?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah we can use something like

if (!process.env.BABEL_8_BREAKING) {
// For easier backward-compatibility, provide an API like the one we exposed in Babel 6.
if (!USE_ESM) {
// eslint-disable-next-line no-restricted-globals
exports.OptionManager = class OptionManager {

@@ -26,66 +26,75 @@ import type * as t from "@babel/types";
const { isCompatTag } = react;
import type { VirtualTypeAliases } from "./virtual-types";

type Opts<Object> = Partial<{
Copy link
Member

Choose a reason for hiding this comment

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

Nit, can you call this Obj to avoid confusion with the global Object constructor?

@@ -26,66 +26,75 @@ import type * as t from "@babel/types";
const { isCompatTag } = react;
import type { VirtualTypeAliases } from "./virtual-types";

type Opts<Object> = Partial<{
[Prop in keyof Object]: Object[Prop] extends t.Node
? t.Node | Object[Prop]
Copy link
Member

Choose a reason for hiding this comment

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

If Object[Prop] extends t.Node, isn't this union just t.Node?

@JLHwung JLHwung merged commit 078d59a into babel:main Jul 31, 2023
57 checks passed
@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 31, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: traverse PR: Polish 💅 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants