gpt4 book ai didi

javascript - 找不到名称 'ReadableStream'

转载 作者:行者123 更新时间:2023-12-05 07:39:52 25 4
gpt4 key购买 nike

我有一个使用@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/whatwg-fetch,因为whatwg-fetch 处于全局范围内并且实现了已经在标准库定义文件中定义的标准。我的项目没有为 whatwg-fetch 使用任何 @types,我引用 ReadableStream 没有问题。这是另一个讨论此问题的链接: whatwg-fetch new typescript 2.5.3 .

关于javascript - 找不到名称 'ReadableStream',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46766471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com