首页 > 解决方案 > 类型具有私有属性的单独声明 - urql 与 @urql

问题描述

看来我在@urql 和urql 之间存在类型冲突。我该如何解决这个问题?

Type 'import("d:/Development/ribbit/web/node_modules/@urql/core/dist/types/types").Exchange' is not assignable to type 'import("d:/Development/ribbit/web/node_modules/urql/node_modules/@urql/core/dist/types/types").Exchange'.
  Types of parameters 'input' and 'input' are incompatible.
    Type 'import("d:/Development/ribbit/web/node_modules/urql/node_modules/@urql/core/dist/types/types").ExchangeInput' is not assignable to type 'import("d:/Development/ribbit/web/node_modules/@urql/core/dist/types/types").ExchangeInput'.
      Types of property 'client' are incompatible.
        Type 'import("d:/Development/ribbit/web/node_modules/urql/node_modules/@urql/core/dist/types/client").Client' is not assignable to type 'import("d:/Development/ribbit/web/node_modules/@urql/core/dist/types/client").Client'.
          Types have separate declarations of a private property 'onOperationStart'.ts(2322)

标签: typescript

解决方案


我将多个版本的 @urql/exchange-graphcache 作为依赖项安装时遇到了这个问题。我通过简单地删除它们并重新安装它们来解决问题。

yarn remove @urql/exchange-graphcache
yarn add @urql/exchange-graphcache

推荐阅读