urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.54k stars 444 forks source link

Introspected schema from urql-introspection doesn't match type of exchange-graphcache #3537

Closed imcvampire closed 3 months ago

imcvampire commented 3 months ago

Describe the bug

                Type 'OperationInstance' is not assignable to type 'OperationInstance | undefined'.
                  Type 'import("/.../node_modules/.pnpm/@urql+core@4.2.0_graphql@16.8.1/node_modules/@urql/core/dist/urql-core-chunk").OperationInstance' is not assignable to type 'import("/.../node_modules/.pnpm/@urql+core@4.3.0_graphql@16.8.1/node_modules/@urql/core/dist/urql-core-chunk").OperationInstance'.
                    Type 'OperationInstance' is not assignable to type '{ readonly _opaque: unique symbol; }'.
                      Types of property '_opaque' are incompatible.
                        Type 'typeof _opaque' is not assignable to type 'typeof _opaque'. Two different types with this name exist, but they are unrelated.

12       cacheExchange({
         ~~~~~~~~~~~~~~~
13         schema: introspectedSchema,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14       }),
   ~~~~~~~~

Reproduction

Urql version

urql: 4.0.6 @urql/exchange-graphcache: 6.5.0

Validations

kitten commented 3 months ago

You've got a duplicated installation of @urql-core, namely 4.2.0 and 4.3.0

Seeing that you're using pnpm, this can either be resolved by running pnpm dedupe, by manually editing the lockfile, or by manually installing a newer one and ensuring that pnpm has replaced the two old versions with just one.