Skip to content

Fix DocumentNode compatibility with exact optional properties - #77

Merged
JoviDeCroock merged 1 commit into
mainfrom
fix/exact-optional-token-count
Jul 10, 2026
Merged

Fix DocumentNode compatibility with exact optional properties#77
JoviDeCroock merged 1 commit into
mainfrom
fix/exact-optional-token-count

Conversation

@JoviDeCroock

Copy link
Copy Markdown
Member

Summary

  • Allow explicit undefined on the optional DocumentNode.tokenCount property
  • Preserve assignability with graphql's DocumentNode when exactOptionalPropertyTypes is enabled

Context

graphql@>=16.10 declares tokenCount as tokenCount?: number | undefined. Our narrower tokenCount?: number override rejects graphql.DocumentNode and packages extending it, such as @graphql-typed-document-node/core, when exact optional property types are enabled.

This causes the regression reported in urql-graphql/urql#3897 after @urql/core started consuming this package's DocumentNode type directly.

Test plan

  • pnpm check
  • pnpm lint
  • pnpm exec vitest run
  • pnpm build
  • Verified the original @graphql-typed-document-node/core assignability reproduction compiles with the widened declaration

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 906818c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@0no-co/graphql.web Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@JoviDeCroock
JoviDeCroock merged commit 26a9233 into main Jul 10, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants