Socket
Socket
Sign inDemoInstall

@graphql-typed-document-node/core

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-typed-document-node/core - npm Package Compare versions

Comparing version 3.2.0-alpha-20230205023330-f05a940 to 3.2.0-alpha-20230309104331-975d9d2

2

package.json
{
"name": "@graphql-typed-document-node/core",
"version": "3.2.0-alpha-20230205023330-f05a940",
"version": "3.2.0-alpha-20230309104331-975d9d2",
"peerDependencies": {

@@ -5,0 +5,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"

import type { DocumentNode } from "graphql";
export type OperationResultType = "stream" | "single";
export interface TypedDocumentNode<Result = {
[key: string]: any;
}, Variables = {
[key: string]: any;
}, ResultType extends OperationResultType = any> extends DocumentNode {
export interface DocumentTypeDecoration<TResult, TVariables> {
/**

@@ -13,4 +8,11 @@ * This type is used to ensure that the variables you pass in to the query are assignable to Variables

*/
__apiType?: (variables: Variables, resultType: ResultType) => Result;
__apiType?: (variables: TVariables) => TResult;
}
export interface TypedDocumentNode<TResult = {
[key: string]: any;
}, TVariables = {
[key: string]: any;
}> extends DocumentNode, DocumentTypeDecoration<TResult, TVariables> {
}
export type TypedDocumentString<TResult, TVariables> = string & DocumentTypeDecoration<TResult, TVariables>;
/**

@@ -22,3 +24,3 @@ * Helper for extracting a TypeScript type for operation result from a TypedDocumentNode.

*/
export type ResultOf<T> = T extends TypedDocumentNode<infer ResultType, any> ? ResultType : never;
export type ResultOf<T> = T extends TypedDocumentNode<infer ResultType, infer VariablesType> ? ResultType : never;
/**

@@ -30,9 +32,2 @@ * Helper for extracting a TypeScript type for operation variables from a TypedDocumentNode.

*/
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;
export type VariablesOf<T> = T extends TypedDocumentNode<infer ResultType, infer VariablesType> ? VariablesType : never;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc