Skip to content

Commit

Permalink
Add ResultOf/VariablesOf helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Jan 10, 2024
1 parent 31418b7 commit 361e8a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,9 @@ interface TadaDocumentNode<
DocumentDecoration<Result, Variables>,
FragmentDefDecoration<Decoration> {}

type ResultOf<T> = T extends DocumentDecoration<infer Result, infer _> ? Result : never;

type VariablesOf<T> = T extends DocumentDecoration<infer _, infer Variables> ? Variables : never;

export { parse, graphql };
export type { setupSchema, TadaDocumentNode };
export type { setupSchema, TadaDocumentNode, ResultOf, VariablesOf };

0 comments on commit 361e8a6

Please sign in to comment.