2013-06-19 38 views
2

我試圖將使用Typescript的環境放在一起。Typescript編譯器錯誤。 'boolean'這個名字在當前範圍中不存在

我用NPM讓我的OS X打字稿,下載了最新的jQuery/jquery.d.ts從https://github.com/borisyankov/DefinitelyTyped

在命令行中運行TSC(使用集成提供相同的結果)結束了以下錯誤:

The name 'boolean' does not exist in the current scope 

問題出現過(類似,但unfound類型是「_Element」)與lib.d.ts型註釋文件。

我正在使用typescript編譯器版本0.9.0.0。

後來編輯:

我肯定輸了,試圖從

http://typescript.codeplex.com/SourceControl/changeset/view/fe3bc0bfce1f#bin/jquery.d.ts

得到jquery.d.ts,現在我已經想出了一個diferent問題,同時編譯它:

jquery.d.ts(37,18): error TS1023: Index signature parameter type must be 'string' or 'number' 

有沒有的TS文件和編譯器,我,我們之間的版本不匹配如果是這樣,我該如何解決它?謝謝。

回答

0

你應該試試這個版本:https://github.com/borisyankov/DefinitelyTyped/blob/master/jquery/jquery.d.ts

也可以嘗試做卸載/安裝打字稿的。

npm uninstall typescript 
npm uninstall -g typescript 
npm install typescript 

也這樣做,我很好奇什麼tsc -version展示在你面前。上述步驟後它有變化嗎?

+0

它現在是0.9.0.0,它的工作很好,jquery.d.ts定義。一路上我可能搞砸了一些東西。謝謝。 –

+0

我仍然有這個問題。我使用你提供的'jquery.d.ts',我試過了tsc v。0.9.0和0.9.1 – jesper

+0

謝謝。更新回答:https://github.com/borisyankov/DefinitelyTyped/blob/master/jquery/jquery.d.ts – basarat

相關問題