Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed May 13, 2024
1 parent e2dc117 commit ed5f692
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions packages/babel-traverse/src/path/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const NodePath_Final = class NodePath {
}
};

Object.assign(NodePath_Final.prototype, {
const methods = {
// NodePath_ancestry
findParent: NodePath_ancestry.findParent,
find: NodePath_ancestry.find,
Expand Down Expand Up @@ -354,7 +354,9 @@ Object.assign(NodePath_Final.prototype, {
shareCommentsWithSiblings: NodePath_comments.shareCommentsWithSiblings,
addComment: NodePath_comments.addComment,
addComments: NodePath_comments.addComments,
});
};

Object.assign(NodePath_Final.prototype, methods);

if (!process.env.BABEL_8_BREAKING) {
// @ts-expect-error The original _guessExecutionStatusRelativeToDifferentFunctions only worked for paths in
Expand Down Expand Up @@ -423,20 +425,7 @@ interface NodePathOverwrites {
): this is NodePath_Final<t.Statement | t.Block>;
}

type NodePathMixins = Omit<
typeof NodePath_ancestry &
typeof NodePath_inference &
typeof NodePath_replacement &
typeof NodePath_evaluation &
typeof NodePath_conversion &
typeof NodePath_introspection &
typeof NodePath_context &
typeof NodePath_removal &
typeof NodePath_modification &
typeof NodePath_family &
typeof NodePath_comments,
keyof NodePathOverwrites
>;
type NodePathMixins = Omit<typeof methods, keyof NodePathOverwrites>;

interface NodePath<T extends t.Node>
extends InstanceType<typeof NodePath_Final>,
Expand Down

0 comments on commit ed5f692

Please sign in to comment.