找不到名字'ReadableStream'

问题描述 投票:1回答:1

我有一个使用@ 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'.

有人知道为什么会这样吗?

我想它正在发生,因为有些东西正在缓存某些东西。我是这么认为的,因为当项目从另一台计算机中删除并从存储库重新克隆时,这个错误就消失了,但是在一段时间后又显示出来了。

如果需要,我会上传更多文件。

javascript typescript webpack
1个回答
0
投票

我认为你根本不需要引用@ types / whatwg-fetch,因为whatwg-fetch在全局范围内并且实现了已经在标准lib定义文件中定义的标准。我的项目没有使用任何@types来获取whatwg-fetch,而且我没有问题地引用ReadableStream。这里有另一个问题的链接:whatwg-fetch new typescript 2.5.3

© www.soinside.com 2019 - 2024. All rights reserved.