Skip to content

Commit

Permalink
Depreacate 'VisitorKeyMap' and backported 'ASTVisitorKeyMap' type (#3267
Browse files Browse the repository at this point in the history
)
  • Loading branch information
IvanGoncharov committed Sep 20, 2021
1 parent 99d6079 commit 201ed90
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/index.d.ts
Expand Up @@ -230,6 +230,7 @@ export {
Visitor,
VisitFn,
VisitorKeyMap,
ASTVisitorKeyMap,
// AST nodes
ASTNode,
ASTKindToNode,
Expand Down
1 change: 1 addition & 0 deletions src/language/index.d.ts
Expand Up @@ -17,6 +17,7 @@ export {
Visitor,
VisitFn,
VisitorKeyMap,
ASTVisitorKeyMap,
} from './visitor';

export {
Expand Down
9 changes: 9 additions & 0 deletions src/language/visitor.d.ts
Expand Up @@ -49,9 +49,18 @@ export type VisitFn<TAnyNode, TVisitedNode = TAnyNode> = (

/**
* A KeyMap describes each the traversable properties of each kind of node.
*
* @deprecated Please using ASTVisitorKeyMap instead
*/
export type VisitorKeyMap<T> = { [P in keyof T]: ReadonlyArray<keyof T[P]> };

/**
* A KeyMap describes each the traversable properties of each kind of node.
*/
export type ASTVisitorKeyMap = {
[P in keyof ASTKindToNode]?: ReadonlyArray<keyof ASTKindToNode[P]>;
};

// TODO: Should be `[]`, but that requires TypeScript@3
type EmptyTuple = Array<never>;

Expand Down

0 comments on commit 201ed90

Please sign in to comment.