Skip to content

Commit 16380f9

Browse files
avalletesoedirgo
authored andcommitted
chore: using type fix the test
1 parent e7eb73b commit 16380f9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/select-query-parser/result.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export type ProcessRPCNode<
135135
: NodeType['type'] extends Ast.FieldNode['type']
136136
? ProcessSimpleField<Row, RelationName, Extract<NodeType, Ast.FieldNode>>
137137
: SelectQueryError<'RPC Unsupported node type.'>
138+
138139
/**
139140
* Process select call that can be chained after an rpc call
140141
*/
@@ -197,13 +198,13 @@ export type ProcessNode<
197198
RelationName extends string,
198199
Relationships extends GenericRelationship[],
199200
NodeType extends Ast.Node
200-
> = NodeType extends Ast.StarNode // If the selection is *
201+
> = NodeType['type'] extends Ast.StarNode['type'] // If the selection is *
201202
? Row
202-
: NodeType extends Ast.SpreadNode // If the selection is a ...spread
203-
? ProcessSpreadNode<Schema, Row, RelationName, Relationships, NodeType>
204-
: NodeType extends Ast.FieldNode
205-
? ProcessFieldNode<Schema, Row, RelationName, Relationships, NodeType>
206-
: SelectQueryError<'Unsupported node type.' & { nodeType: NodeType }>
203+
: NodeType['type'] extends Ast.SpreadNode['type'] // If the selection is a ...spread
204+
? ProcessSpreadNode<Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.SpreadNode>>
205+
: NodeType['type'] extends Ast.FieldNode['type']
206+
? ProcessFieldNode<Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.FieldNode>>
207+
: SelectQueryError<'Unsupported node type.'>
207208

208209
/**
209210
* Processes a FieldNode and returns the resulting TypeScript type.

0 commit comments

Comments
 (0)