我正在从角度5迁移到角度6.当我进行npm运行构建时,我是向控制台抛出以下错误:
ngc编译失败:ng-formly / core / src / components / formly.field.ts(10,10):错误TS2305:模块'“C:/PrjNET/Elevation3/FW/4.00/Mainline/Framework/Development/Client /ElevationJS/ngcore/.tmp/node_modules/rxjs/Subscription“'没有导出的成员'订阅' .
我有一个类似的错误: rxjs/Subscription has no exported member Subscription
我通过导入Subscription来解决这个问题:
import { Subscription } from "rxjs";
但我不能这样做 ISubscription
.
任何人都知道如何导入ISubscription?
2 回答
在RxJS v6中,
ISubscription
被重命名为SubscriptionLike
,因为's the convention used in Typescript'拥有自己的类型声明 .同样,
IScheduler
已重命名为SchedulerLike
.我不认为你可以直接使用
ISubscription
界面 . 如果检查Subscription.d.ts
,则该接口没有declare
类型 . 我认为你必须使用Subscription
,因为它正在实现ISubscription
接口 .