Skip to content

Commit

Permalink
Fix type dependence in formatDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Mar 24, 2023
1 parent af2ef5a commit 54f8df2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/utils/typenames.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Kind, SelectionNode, DefinitionNode } from '@0no-co/graphql.web';
import type { DocumentNode } from './graphql';
import { KeyedDocumentNode, keyDocument } from './request';
import { TypedDocumentNode } from '../types';

interface EntityLike {
[key: string]: EntityLike | EntityLike[] | any;
Expand Down Expand Up @@ -98,7 +98,9 @@ const formattedDocs = new Map<number, KeyedDocumentNode>();
* @see {@link https://spec.graphql.org/October2021/#sec-Type-Name-Introspection} for more information
* on typename introspection via the `__typename` field.
*/
export const formatDocument = <T extends DocumentNode>(node: T): T => {
export const formatDocument = <T extends TypedDocumentNode<any, any>>(
node: T
): T => {
const query = keyDocument(node);

let result = formattedDocs.get(query.__key);
Expand Down

0 comments on commit 54f8df2

Please sign in to comment.