【问题标题】:Typescript compiler error. The name 'boolean' does not exist in the current scope打字稿编译器错误。当前范围内不存在名称“布尔”
【发布时间】:2013-06-19 09:06:58
【问题描述】:

我正在尝试构建一个使用 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”)。

我正在使用 typescript 编译器版本 0.9.0.0。

后期编辑:

我肯定迷路了,尝试从

获取 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 文件和我正在使用的编译器之间是否存在版本不匹配,如果是,我该如何解决?谢谢。

【问题讨论】:

    标签: jquery typescript


    【解决方案1】:

    你应该试试这个版本:https://github.com/borisyankov/DefinitelyTyped/blob/master/jquery/jquery.d.ts

    还可以尝试卸载/安装打字稿。

    npm uninstall typescript 
    npm uninstall -g typescript 
    npm install typescript 
    

    在此之前,我很好奇tsc -version 向您展示了什么。经过上述步骤后有变化吗?

    【讨论】:

    • 它现在是 0.9.0.0,它适用于 jquery.d.ts 定义。一路上的某个地方,我可能搞砸了一些事情。谢谢。
    • 我还是有这个问题。我使用您提供的jquery.d.ts,并且我已经尝试过 tsc v. 0.9.0 和 0.9.1
    猜你喜欢
    • 2013-02-21
    • 2012-12-09
    • 1970-01-01
    • 2019-02-27
    • 1970-01-01
    • 2020-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多