diff --git a/.changeset/tidy-bags-fix.md b/.changeset/tidy-bags-fix.md new file mode 100644 index 0000000..62c93d3 --- /dev/null +++ b/.changeset/tidy-bags-fix.md @@ -0,0 +1,5 @@ +--- +'@0no-co/graphql.web': patch +--- + +Allow `undefined` on `DocumentNode.tokenCount` to preserve compatibility with `graphql` when `exactOptionalPropertyTypes` is enabled. diff --git a/src/ast.ts b/src/ast.ts index c04df5a..817cada 100644 --- a/src/ast.ts +++ b/src/ast.ts @@ -99,12 +99,12 @@ export type NameNode = Or< >; export type DocumentNode = Or< - GraphQL.DocumentNode & { readonly tokenCount?: number }, + GraphQL.DocumentNode & { readonly tokenCount?: number | undefined }, { readonly kind: Kind.DOCUMENT; readonly definitions: ReadonlyArray; readonly loc?: Location; - readonly tokenCount?: number; + readonly tokenCount?: number | undefined; } >;