Skip to content

Conversation

@eddeee888
Copy link
Collaborator

@eddeee888 eddeee888 commented Jan 8, 2026

Description

any disables any typechecks and feedback from the TypeScript language server.
unknown forces the user to check at runtime, so it's better than any.

This PR:

  • changes the default scalar type to unknown for the reasons above.
  • Input and Variables fields may take undefined values if it is nullable

Related #10496

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@changeset-bot
Copy link

changeset-bot bot commented Jan 8, 2026

⚠️ No Changeset found

Latest commit: ffb3b8f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/cli 6.1.1-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/introspection 5.0.1-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/visitor-plugin-common 7.0.0-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-document-nodes 5.0.8-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations 5.1.3-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-operations 6.0.0-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-resolvers 6.0.0-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/typed-document-node 6.1.6-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript 6.0.0-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 6.0.0-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎
@graphql-codegen/graphql-modules-preset 5.1.3-alpha-20260108144012-ffb3b8f6699be60beacb03a4eeed3051b758e606 npm ↗︎ unpkg ↗︎

@eddeee888 eddeee888 force-pushed the master-next-default-scalar-type-is-unknown branch from 3c7cf8c to 1f47eb4 Compare January 8, 2026 14:34
@eddeee888 eddeee888 force-pushed the master-next-default-scalar-type-is-unknown branch from 1f47eb4 to ffb3b8f Compare January 8, 2026 14:38
}

typePart = usedInputType.tsType; // If the schema is correct, when reversing typeNodes, the first node would be `NamedType`, which means we can safely set it as the base for typePart
if (usedInputType.tsType !== 'any' && !typeNode.isNonNullable) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When unknown and any is used, | null | undefined is not required.
However, the logic could be complex, so I'll bring back this condition and tests in another PR.

@eddeee888 eddeee888 marked this pull request as ready for review January 10, 2026 14:05
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