@graphql-typed-document-node/core
Advanced tools
Comparing version 3.1.2-alpha-20230205022655-fa2a421 to 3.2.0-alpha-20230205023330-f05a940
{ | ||
"name": "@graphql-typed-document-node/core", | ||
"version": "3.1.2-alpha-20230205022655-fa2a421", | ||
"version": "3.2.0-alpha-20230205023330-f05a940", | ||
"peerDependencies": { | ||
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" | ||
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" | ||
}, | ||
@@ -7,0 +7,0 @@ "repository": "git@github.com:dotansimha/graphql-typed-document-node.git", |
import type { DocumentNode } from "graphql"; | ||
export type OperationResultType = "stream" | "single"; | ||
export interface TypedDocumentNode<Result = { | ||
@@ -6,3 +7,3 @@ [key: string]: any; | ||
[key: string]: any; | ||
}> extends DocumentNode { | ||
}, ResultType extends OperationResultType = any> extends DocumentNode { | ||
/** | ||
@@ -13,3 +14,3 @@ * This type is used to ensure that the variables you pass in to the query are assignable to Variables | ||
*/ | ||
__apiType?: (variables: Variables) => Result; | ||
__apiType?: (variables: Variables, resultType: ResultType) => Result; | ||
} | ||
@@ -22,3 +23,3 @@ /** | ||
*/ | ||
export type ResultOf<T> = T extends TypedDocumentNode<infer ResultType, infer VariablesType> ? ResultType : never; | ||
export type ResultOf<T> = T extends TypedDocumentNode<infer ResultType, any> ? ResultType : never; | ||
/** | ||
@@ -30,2 +31,9 @@ * Helper for extracting a TypeScript type for operation variables from a TypedDocumentNode. | ||
*/ | ||
export type VariablesOf<T> = T extends TypedDocumentNode<infer ResultType, infer VariablesType> ? VariablesType : never; | ||
export type VariablesOf<T> = T extends TypedDocumentNode<any, infer VariablesType> ? VariablesType : never; | ||
/** | ||
* Helper for extracting a TypeScript type for operation type from a TypedDocumentNode. | ||
* @example | ||
* const myQuery = { ... }; // TypedDocumentNode<R, V, O> | ||
* type OperationType = VariablesOf<typeof myQuery>; // Now it's O | ||
*/ | ||
export type OperationTypeOf<T> = T extends TypedDocumentNode<any, any, infer OperationType> ? OperationType : never; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3262
35