Skip to content

Commit

Permalink
convert $Values (flow) to keyof (TS)
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Nov 19, 2020
1 parent 8c59969 commit 79da01a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/language/directiveLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export const DirectiveLocation = Object.freeze({
/**
* The enum type representing the directive location values.
*/
export type DirectiveLocationEnum = $Values<typeof DirectiveLocation>;
export type DirectiveLocationEnum = typeof DirectiveLocation[keyof typeof DirectiveLocation];
2 changes: 1 addition & 1 deletion src/language/kinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ export const Kind = Object.freeze({
/**
* The enum type representing the possible kind values of AST nodes.
*/
export type KindEnum = $Values<typeof Kind>;
export type KindEnum = typeof Kind[keyof typeof Kind];
2 changes: 1 addition & 1 deletion src/language/tokenKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export const TokenKind = Object.freeze({
/**
* The enum type representing the token kinds values.
*/
export type TokenKindEnum = $Values<typeof TokenKind>;
export type TokenKindEnum = typeof TokenKind[keyof typeof TokenKind];
2 changes: 1 addition & 1 deletion src/language/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isNode } from './ast';
* relevant functions to be called during the visitor's traversal.
*/
export type ASTVisitor = Visitor<ASTKindToNode>;
export type Visitor<KindToNode, Nodes = $Values<KindToNode>> =
export type Visitor<KindToNode, Nodes = KindToNode[keyof KindToNode]> =
| EnterLeave<
| VisitFn<Nodes>
| ShapeMap<KindToNode, <Node>(Node) => VisitFn<Nodes, Node>>
Expand Down

0 comments on commit 79da01a

Please sign in to comment.