Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compatibility with TypeScript 5.5 and Yarn Berry #3730

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

andreisergiu98
Copy link

Resolves #3724

Summary

  1. TypeScript changed the behaviour of "unresolved" any from 5.5 so doing type Doc = OrNever<UnresolvedType> | LocalType will always be any.
  2. Without graphql as optional peer dependency in @urql/core, graphql.web will be unable to resolve it when using a strict package manager like Yarn Berry.

Both problems are covered by #3724

Set of changes

  1. Changed OrNever to
type OrNever<T> = void extends T ? never : T;

Which is compatible with both newer and older TypeScript versions.

  1. Added graphql as optional peer dependency for packages that are using graphql.web

As a sidenote, there is a graphql import without fallback in urql/packages/preact-urql/src/hooks/useRequest.ts that will also break inference, but I am not sure how would you like to handle that.

Copy link

changeset-bot bot commented Jan 5, 2025

🦋 Changeset detected

Latest commit: dc21689

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

This PR includes changesets to release 2 packages
Name Type
@urql/exchange-graphcache Patch
@urql/core 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

@andreisergiu98 andreisergiu98 changed the title fix: compatibility with typescript 5.5 and graphql peer for graphql.web fix: compatibility with typescript 5.5 and Yarn Berry Jan 5, 2025
@andreisergiu98 andreisergiu98 changed the title fix: compatibility with typescript 5.5 and Yarn Berry fix: compatibility with TypeScript 5.5 and Yarn Berry Jan 5, 2025
@andreisergiu98
Copy link
Author

andreisergiu98 commented Jan 6, 2025

We could wait for this release 0no-co/graphql.web#50 and also include a version bump with this PR.

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.

graphql is not declared as peer dependency
1 participant