我正在尝试构建一个使用 Typescript 的环境。
我使用 npm 在我的 OS X 上获取 typescript ,从 https://github.com/borisyankov/DefinitelyTyped 下载了最新的 jquery/jquery.d.ts
在命令行中运行 tsc(使用集成提供的相同结果)以以下错误结束:
The name 'boolean' does not exist in the current scope
lib.d.ts 类型注释文件也出现了问题(类似,但未找到的类型是“_element”)。
我使用的是 0.9.0.0 版的 typescript 编译器。
稍后编辑:
我肯定迷路了,尝试从中获取 jquery.d.ts
http://typescript.codeplex.com/SourceControl/changeset/view/fe3bc0bfce1f#bin/jquery.d.ts
现在我在编译时遇到了一个不同的问题:
jquery.d.ts(37,18): error TS1023: Index signature parameter type must be 'string' or 'number'
ts 文件和我正在使用的编译器之间是否存在版本不匹配?如果是,我该如何解决?谢谢。
最佳答案
你应该试试这个版本:https://github.com/borisyankov/DefinitelyTyped/blob/master/jquery/jquery.d.ts
也尝试卸载/安装 typescript 。
npm uninstall typescript
npm uninstall -g typescript
npm install typescript
此外,在执行此操作之前,我很好奇 tsc -version
向您展示了什么。经过上述步骤后它有变化吗?
关于jquery - typescript 编译器错误。当前范围内不存在名称 'boolean',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17187246/