【发布时间】:2018-03-27 17:56:50
【问题描述】:
我有一个使用 @types/whatwg-fetch 版本 0.0.32 的项目。
运行我的项目时出现以下错误。
ERROR in <project-root>/node_modules/@types/whatwg-fetch/index.d.ts
(97,11): error TS2304: Cannot find name 'ReadableStream'.
我添加了@types/whatwg-streams 0.0.4 版,但它仍然失败并出现同样的错误。将 whatwg-fetch 更新到最新的 0.0.33,只会多显示一行错误:
ERROR in /home/vojda/workspace/honeybee/acquisition/node_modules/@types/whatwg-fetch/index.d.ts
(32,44): error TS2304: Cannot find name 'ReadableStream'.
ERROR in /home/vojda/workspace/honeybee/acquisition/node_modules/@types/whatwg-fetch/index.d.ts
(102,20): error TS2304: Cannot find name 'ReadableStream'.
有人知道为什么会这样吗?
我想它正在发生是因为某些东西正在缓存某些东西。我想是的,因为当项目从另一台计算机中删除并从存储库中重新克隆时,此错误消失了,但过一段时间又出现了。
如果需要,我会上传更多文件。
【问题讨论】:
-
你安装
@types/node了吗?它们应该包含ReadableStream的类型定义。 -
是的,已经安装了。
-
github.com/DefinitelyTyped/DefinitelyTyped/issues/20608 - 我已经记录了一个错误,正在等待看看会发生什么。之后我会更新这个问题。
标签: javascript typescript webpack