Skip to content

Commit

Permalink
chore: add TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
soedirgo committed Nov 5, 2024
1 parent 16380f9 commit f22849b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/select-query-parser/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,15 @@ export type ProcessNode<
RelationName extends string,
Relationships extends GenericRelationship[],
NodeType extends Ast.Node
> = NodeType['type'] extends Ast.StarNode['type'] // If the selection is *
? Row
: NodeType['type'] extends Ast.SpreadNode['type'] // If the selection is a ...spread
? ProcessSpreadNode<Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.SpreadNode>>
: NodeType['type'] extends Ast.FieldNode['type']
? ProcessFieldNode<Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.FieldNode>>
: SelectQueryError<'Unsupported node type.'>
> =
// TODO: figure out why comparing the `type` property is necessary vs. `NodeType extends Ast.StarNode`
NodeType['type'] extends Ast.StarNode['type'] // If the selection is *
? Row
: NodeType['type'] extends Ast.SpreadNode['type'] // If the selection is a ...spread
? ProcessSpreadNode<Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.SpreadNode>>
: NodeType['type'] extends Ast.FieldNode['type']
? ProcessFieldNode<Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.FieldNode>>
: SelectQueryError<'Unsupported node type.'>

/**
* Processes a FieldNode and returns the resulting TypeScript type.
Expand Down

0 comments on commit f22849b

Please sign in to comment.