【问题标题】:rxjs/Subscription has no exported member 'ISubscription'rxjs/Subscription 没有导出的成员“ISubscription”
【发布时间】:2019-03-01 02:48:27
【问题描述】:

我正在从 angular 5 迁移到 angular 6。当我进行 npm run build 时,我会向控制台抛出以下错误:

ngc 编译失败:ng-formly/core/src/components/formly.field.ts(10,10): error TS2305: Module '"C:/PrjNET/Elevation3/FW/4.00/Mainline/Framework/Development /Client/ElevationJS/ngcore/.tmp/node_modules/rxjs/Subscription"' 没有导出的成员 'Subscription'。

我遇到了类似的错误:rxjs/Subscription has no exported member Subscription,我通过像这样导入订阅来解决:

import { Subscription } from "rxjs";

但我不能对ISubscription做同样的事情。

有人知道如何导入 ISubscription 吗?

【问题讨论】:

  • 现在是SubscriptionLike
  • @cartant 你能把这个作为答案吗?

标签: angular rxjs


【解决方案1】:

在 RxJS v6 中,ISubscription 被重命名为 SubscriptionLike,因为这是 Typescript 自己的类型声明中使用的约定。

同样,IScheduler 已重命名为 SchedulerLike

【讨论】:

    【解决方案2】:

    我不认为你可以直接使用ISubscription 接口。如果您检查Subscription.d.ts,则该接口没有declare 类型。我认为您必须使用Subscription,因为它正在实现ISubscription 接口。

    【讨论】:

      猜你喜欢
      • 2018-10-15
      • 2017-12-29
      • 2018-11-07
      • 2018-10-20
      • 2019-11-04
      • 2018-05-22
      • 2018-11-29
      • 1970-01-01
      • 2019-03-01
      相关资源
      最近更新 更多