clentfort / urql-custom-scalars-exchange

MIT License
36 stars 19 forks source link

Support `urql@^4.0.0` #24

Open ericbf opened 1 year ago

ericbf commented 1 year ago

There were some breaking changes in 4.0.0 that make the interface incompatible, at least type-wise.

Works:

image

Doesn’t work:

image

Error:

Type 'import("<path>/node_modules/@urql/core/dist/urql-core-chunk").Exchange' is not assignable to type 'import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").Exchange'.
  Types of parameters 'input' and 'input' are incompatible.
    Type 'import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").ExchangeInput' is not assignable to type 'import("<path>/node_modules/@urql/core/dist/urql-core-chunk").ExchangeInput'.
      The types of 'client.operations$' are incompatible between these types.
        Type 'import("<path>/node_modules/wonka/dist/wonka").Source<import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").Operation<any, import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").AnyVariabl...' is not assignable to type 'import("<path>/node_modules/wonka/dist/wonka").Source<import("<path>/node_modules/@urql/core/dist/urql-core-chunk").Operation<any, import("<path>/node_modules/@urql/core/dist/urql-core-chunk").AnyVariables>>'.
          Type 'import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").Operation<any, import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").AnyVariables>' is not assignable to type 'import("<path>/node_modules/@urql/core/dist/urql-core-chunk").Operation<any, import("<path>/node_modules/@urql/core/dist/urql-core-chunk").AnyVariables>'.
            The types of 'context._instance' are incompatible between these types.
              Type 'import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").OperationInstance | undefined' is not assignable to type 'import("<path>/node_modules/@urql/core/dist/urql-core-chunk").OperationInstance | undefined'.
                Type 'OperationInstance' is not assignable to type 'OperationInstance | undefined'.
                  Type 'import("<path>/node_modules/urql/node_modules/@urql/core/dist/urql-core-chunk").OperationInstance' is not assignable to type 'import("<path>/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.ts(2322)
AlbertMarashi commented 1 year ago

+1 I need this

mvarendorff2 commented 3 days ago

The PR linked above is included in the fork available as @atmina/urql-custom-scalars-exchange@1.1.0 on NPM :)