Typescript从1.0.0到1.1.0-1-错误TS2411
我最近更新了我的TypeScript(Typescript从1.0.0到1.1.0-1-错误TS2411,typescript,Typescript,我最近更新了我的TypeScript(npm安装TypeScript-g) 因为,我每次编译时都会出现以下错误,编译工作正常,但很无聊 cmd.exe /D /C C:/Users/Vado/AppData/Roaming/npm/tsc.cmd --sourcemap Controller.ts -t ES5 --module commonJs ../../shared/app/lib/def/lib.d.ts(4552,5): error TS2411: Property 'length'
npm安装TypeScript-g
)
因为,我每次编译时都会出现以下错误,编译工作正常,但很无聊
cmd.exe /D /C C:/Users/Vado/AppData/Roaming/npm/tsc.cmd --sourcemap Controller.ts -t ES5 --module commonJs
../../shared/app/lib/def/lib.d.ts(4552,5): error TS2411: Property 'length' of type 'number' is not assignable to string index type 'Object'.
../../shared/app/lib/def/lib.d.ts(4553,5): error TS2411: Property 'add' of type '(namespace?: string, urn?: string, implementationUrl?: any) => Object' is not assignable to string index type 'Object'.
../../shared/app/lib/def/lib.d.ts(4554,5): error TS2411: Property 'item' of type '(index: any) => Object' is not assignable to string index type 'Object'.
Process finished with exit code 1
自由民主党议员:4551:
我不明白怎么了。我怎样才能解决这个问题?我没有更新
lib.d.ts
,它与1.0.0
中的文件相同您需要使用tsc.js
附带的匹配lib.d.ts
。看起来您正在从其他路径(app/lib/def
?)使用一些自定义的lib.d.ts
。所有类型脚本文件都会发生这种情况吗?我不能用1.1复制这个问题。那么,那lib.d.ts
来自哪里?文件确实从1.0更改为1.1。项目中的所有TS文件,是的。因为我已经更新了TS。lib.d.TS
是我在项目中使用的库。我需要在我的项目中引用它,否则当它编译时,我会收到关于不存在类的警告。我需要,只是我需要引用它,否则当我编译TS时,我找不到一些基本引用。我一年前就解决了这个问题,所以我记不太清楚了。谢谢,它帮助我解决了这个问题。。。我实际上删除了lib.d.ts,现在看来ts会自动链接它,以前我不得不手动操作。
interface MSNamespaceInfoCollection {
length: number;
add(namespace?: string, urn?: string, implementationUrl?: any): Object;
item(index: any): Object;
[index: string]: Object;
}