【发布时间】:2020-06-02 10:41:24
【问题描述】:
我有一个使用 typescript 版本 2.9.2 的 Angular(版本 6)项目。
我正在迁移到 Angular 的最新版本 9。
迁移的一个步骤是将 typescript 版本更新到 3.7.5。
更新 typescript 后,我在其中一个库上遇到编译错误 - https://github.com/jf3096/json-typescript-mapper - 此库不再处于活动状态。
187 instance[key] = decoratorMetaData.customConverter.fromJson(json[decoratorMetaData.name || key]); ~~~~~~~~~~~~~ node_modules/json-typescript-mapper/index.ts:189:13 - 错误 TS2536:类型“字符串”不能用于索引类型“T”。
更新打字稿后有人遇到过类似的问题吗? 关于如何解决此问题的任何想法?
谢谢
【问题讨论】:
-
Angular 6 正式不支持 Typescript v3.7.5。需要进行一些额外的配置,以使其正常工作(如果有可能的话)
-
@boop_the_snoot 这个错误发生在我已经迁移到 angular 版本 9 之后。
-
您是否正确执行了迁移步骤? Please take a look again on the upgrade guide
-
我做到了。这与打字稿比角度更相关。
标签: angular typescript typescript-generics