gpt4 book ai didi

typescript 1.5 - 'Duplicate identifier' 错误

转载 作者:搜寻专家 更新时间:2023-10-30 21:54:11 25 4
gpt4 key购买 nike

我使用 Typescript 1.5.0 beta 创建了一个非常简单的项目,并包含了带有 tsd 的 threejs/three 类型。编译时,tsc 输出关于 Duplicate Identifier 'identifier' 的 128 个错误。我不确定 128 是否只是 tsc 开始截断错误的地方,所以可能还有更多...

我通过创建一个空白文件夹并创建 app.ts 和 index.html 来启动该项目。然后我使用以下命令安装了 threejs/three:

tsd install threejs/three -rso

在我的 app.ts 中,我只添加了以下行,并进行了编译:

/// <reference path="typings/tsd.d.ts"/>

现在,从命令行编译就足够了,我正在使用以下命令:

tsc --module commonjs --target es5 ./app.ts

这是我从 tsc 得到的完整错误列表的链接:

https://gist.github.com/josefvanniekerk/24496b480bf488db522d

知道为什么 tsc 会提示吗?

最佳答案

问题出在 typings/webaudioapi/waa.d.ts 中。 TypeScript 1.5 在内部包含 Web Audio API 声明,您会得到重复的标识符。

要解决此问题,请删除 typings/webaudioapi/waa.d.ts 文件并从 typings/tsd.d.ts 中删除对它的引用>

在以前版本的 TypeScript 编译器中,不包含此文件,也不会显示错误。

关于 typescript 1.5 - 'Duplicate identifier' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30705338/

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