Skip to content

Commit

Permalink
[@babel/traverse]: Allowed node aliases as keys in visitors.
Browse files Browse the repository at this point in the history
This is made possible by babel/babel#9110.

When the next version after v7.2.2 is released, the package.json can be updated and the build will no longer fail.
  • Loading branch information
cameron-martin committed Dec 19, 2018
1 parent 50a61de commit bbc6a27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions types/babel__traverse/babel__traverse-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,8 @@ const VisitorStateTest: Visitor<SomeVisitorState> = {
}
}
};

const VisitorAliasTest: Visitor = {
Function() {},
Expression() {},
};
2 changes: 2 additions & 0 deletions types/babel__traverse/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ export class Binding {

export type Visitor<S = {}> = VisitNodeObject<S, Node> & {
[Type in Node["type"]]?: VisitNode<S, Extract<Node, { type: Type; }>>;
} & {
[K in keyof t.Aliases]?: VisitNode<S, t.Aliases[K]>
};

export type VisitNode<S, P> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
Expand Down

0 comments on commit bbc6a27

Please sign in to comment.