Urql: Typescript problem with types in exchange-multipart-fetch

Created on 1 Sep 2020  路  6Comments  路  Source: FormidableLabs/urql

Using

"urql": "1.10.0"
"@urql/exchange-multipart-fetch": "0.1.8"

and typescript 4.0.2 there is a compile time error when adding the multipartFetchExchange in the exchanges on `createClient':

Type 'import(/node_modules/@urql/core/dist/types/types").Exchange' is not assignable to type 'import(/node_modules/urql/node_modules/@urql/core/dist/types/types").Exchange'.
Types of parameters 'input' and 'input' are incompatible.

Type 'import(/node_modules/urql/node_modules/@urql/core/dist/types/types").ExchangeInput' is not assignable to type 'import(/node_modules/@urql/core/dist/types/types").ExchangeInput'.
Types of property 'client' are incompatible.

Type 'import(/node_modules/urql/node_modules/@urql/core/dist/types/client").Client' is not assignable to type 'import(/node_modules/@urql/core/dist/types/client").Client'.
Types have separate declarations of a private property 'createOperationContext'.
bug 馃悰

Most helpful comment

Could you try running yarn why @urql/core or list out your @urql/core versions with npm. This would imply that you have a duplicate equivalent of @urql/core floating around. The one in urql doesn't seem deduplicated judging from the error.

You could try running yarn-deduplicate

All 6 comments

Could you try running yarn why @urql/core or list out your @urql/core versions with npm. This would imply that you have a duplicate equivalent of @urql/core floating around. The one in urql doesn't seem deduplicated judging from the error.

You could try running yarn-deduplicate

That was the issue.
npm ci resolved the situation.

Thanks a ultra lot @JoviDeCroock

Thank you, @JoviDeCroock ! I just ran into the same issue when adding cacheExchange and devtoolsExchange, and this saved me from a ton of req squiggles in my IDE 馃帀

Hi! Can confirm this is still an issue in a yarn workspace environment.
Adding "workspaces": { "nohoist": [ "@urql/**" ] }, to packages/a/package.json fixed it for now :)

@Corjen that may lead to more issues in the future 馃槄 I鈥檇 still instead recommend to use yarn-deduplicate or even a resolution on @urql/Core to make sure that you only have one installation of the package and one entry for it in your lock file.

Nevermind 馃槃 removed the nohoist property, did a reinstall and it鈥檚 working now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BjoernRave picture BjoernRave  路  3Comments

capaj picture capaj  路  5Comments

Andrew-Talley picture Andrew-Talley  路  4Comments

TLadd picture TLadd  路  4Comments

andyrichardson picture andyrichardson  路  4Comments