FormidableLabs / next-urql

Convenience utilities for using urql with NextJS.
MIT License
56 stars 7 forks source link

Incompatible with URQL >=1.9 #41

Closed hugo closed 4 years ago

hugo commented 4 years ago

Upgrading from 0.2.3 to 0.3.0 results in the following error:

$ tsc --noEmit
node_modules/next-urql/src/types.ts:3:38 - error TS2307: Cannot find module 'urql/dist/types/exchanges/ssr'.

3 import { SSRExchange, SSRData } from 'urql/dist/types/exchanges/ssr';
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error.

This is because those type definitions are now under the @urql/core namespace.

As a temporary work around I have added the following to my tsconfig.json:

{
  "compilerOptions": {
    "paths": {
      "urql/dist/types/exchanges/*": [
        "node_modules/@urql/core/dist/types/exchanges/*"
      ]
    }
  }
}

Currently this project's package.json specifies "urql": "^1.1.0" which isn't even a year old. I don't know if it's possible to maintain compatibility with older versions and >=1.9.

parkerziegler commented 4 years ago

👋 Hey @hugo thanks for opening the issue, and nice workaround. Yeah I think we'll have to just push a new minor and let people know that they'll need to use 0.3.0 if using urql < 1.9.0 and 0.4.0. if using >= 1.9.0. Hopefully this can help encourage migration to newer urql versions as well!

parkerziegler commented 4 years ago

@hugo this should be fixed in v0.3.1: https://github.com/FormidableLabs/urql/blob/master/packages/next-urql/CHANGELOG.md#031 If this still an issue for you, please raise a new issue over in the urql monorepo, as that's where next-urql has moved, and tag it with the next-urql tag. Thanks!