我的档案内容," blah.ts"是
///<reference path="jquery.d.ts">
那就是它。
该文件,&#34; jquery.d.ts&#34;与#34; blah.ts&#34;处于同一水平。
我从here
复制并粘贴了jquery.d.ts我使用npm安装了typescript,版本为1.3.0.0。
当我跑步时
tsc blah.ts
我收到了一页错误
query.d.ts(279,40): error TS1005: ',' expected.
jquery.d.ts(279,61): error TS1005: '=' expected.
jquery.d.ts(279,64): error TS1109: Expression expected.
jquery.d.ts(279,97): error TS1005: ',' expected.
jquery.d.ts(279,118): error TS1005: '=' expected.
jquery.d.ts(279,121): error TS1109: Expression expected.
jquery.d.ts(342,40): error TS1005: ',' expected.
jquery.d.ts(342,61): error TS1005: '=' expected.
jquery.d.ts(342,64): error TS1109: Expression expected.
jquery.d.ts(342,103): error TS1005: ',' expected.
jquery.d.ts(342,124): error TS1005: '=' expected.
jquery.d.ts(342,127): error TS1109: Expression expected.
jquery.d.ts(352,48): error TS1005: ',' expected.
jquery.d.ts(352,69): error TS1005: '=' expected.
jquery.d.ts(352,72): error TS1109: Expression expected.
jquery.d.ts(352,111): error TS1005: ',' expected.
jquery.d.ts(352,132): error TS1005: '=' expected.
jquery.d.ts(352,135): error TS1109: Expression expected.
jquery.d.ts(677,35): error TS1005: ',' expected.
jquery.d.ts(677,36): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(692,39): error TS1005: ',' expected.
jquery.d.ts(692,40): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(722,36): error TS1005: ',' expected.
jquery.d.ts(722,37): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(744,41): error TS1005: ',' expected.
jquery.d.ts(744,42): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1214,36): error TS1005: ',' expected.
jquery.d.ts(1214,37): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1255,46): error TS1005: ',' expected.
jquery.d.ts(1311,45): error TS1005: ',' expected.
jquery.d.ts(1311,52): error TS1005: ',' expected.
jquery.d.ts(1383,22): error TS1005: ',' expected.
jquery.d.ts(1383,29): error TS1005: '=' expected.
jquery.d.ts(1404,44): error TS1005: ',' expected.
jquery.d.ts(1411,78): error TS1005: ',' expected.
jquery.d.ts(1428,25): error TS1005: ',' expected.
jquery.d.ts(1434,59): error TS1005: ',' expected.
jquery.d.ts(1446,31): error TS1005: ',' expected.
jquery.d.ts(1458,29): error TS1005: ',' expected.
jquery.d.ts(1489,30): error TS1005: ',' expected.
jquery.d.ts(1503,29): error TS1005: ',' expected.
jquery.d.ts(1541,24): error TS1005: ',' expected.
jquery.d.ts(1547,57): error TS1005: ',' expected.
jquery.d.ts(1615,50): error TS1005: ',' expected.
jquery.d.ts(1615,51): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1624,50): error TS1005: ',' expected.
jquery.d.ts(1624,51): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1647,29): error TS1005: ',' expected.
jquery.d.ts(1647,30): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1655,29): error TS1005: ',' expected.
jquery.d.ts(1655,30): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1669,30): error TS1005: ',' expected.
jquery.d.ts(1669,31): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1677,30): error TS1005: ',' expected.
jquery.d.ts(1677,31): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1692,28): error TS1005: ',' expected.
jquery.d.ts(1701,28): error TS1005: ',' expected.
jquery.d.ts(1709,33): error TS1005: ',' expected.
jquery.d.ts(1709,34): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1717,33): error TS1005: ',' expected.
jquery.d.ts(1717,34): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1738,27): error TS1005: ',' expected.
jquery.d.ts(1738,28): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1746,27): error TS1005: ',' expected.
jquery.d.ts(1746,28): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1760,27): error TS1005: ',' expected.
jquery.d.ts(1760,28): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1768,27): error TS1005: ',' expected.
jquery.d.ts(1768,28): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1782,32): error TS1005: ',' expected.
jquery.d.ts(1782,33): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1790,32): error TS1005: ',' expected.
jquery.d.ts(1790,33): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1804,34): error TS1005: ',' expected.
jquery.d.ts(1804,35): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1812,34): error TS1005: ',' expected.
jquery.d.ts(1812,35): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1826,30): error TS1005: ',' expected.
jquery.d.ts(1826,31): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1834,30): error TS1005: ',' expected.
jquery.d.ts(1834,31): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1864,29): error TS1005: ',' expected.
jquery.d.ts(1864,30): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(1872,29): error TS1005: ',' expected.
jquery.d.ts(1872,30): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(2464,55): error TS1005: ',' expected.
jquery.d.ts(2464,56): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(2471,62): error TS1005: ',' expected.
jquery.d.ts(2471,63): error TS1016: A required parameter cannot follow an optional parameter.
jquery.d.ts(2584,27): error TS1005: ',' expected.
jquery.d.ts(2584,31): error TS1005: '=' expected.
jquery.d.ts(2598,28): error TS1005: ',' expected.
jquery.d.ts(2598,32): error TS1005: '=' expected.
jquery.d.ts(2611,28): error TS1005: ',' expected.
jquery.d.ts(2611,32): error TS1005: '=' expected.
jquery.d.ts(2619,28): error TS1005: ',' expected.
jquery.d.ts(2619,32): error TS1005: '=' expected.
jquery.d.ts(2652,31): error TS1005: ',' expected.
jquery.d.ts(2652,35): error TS1005: '=' expected.
jquery.d.ts(2659,32): error TS1005: ',' expected.
jquery.d.ts(2659,36): error TS1005: '=' expected.
jquery.d.ts(2667,29): error TS1005: ',' expected.
jquery.d.ts(2667,33): error TS1005: '=' expected.
jquery.d.ts(2680,29): error TS1005: ',' expected.
jquery.d.ts(2680,33): error TS1005: '=' expected.
jquery.d.ts(2694,30): error TS1005: ',' expected.
jquery.d.ts(2694,34): error TS1005: '=' expected.
jquery.d.ts(2701,35): error TS1005: ',' expected.
jquery.d.ts(2701,39): error TS1005: '=' expected.
jquery.d.ts(2718,22): error TS1005: ',' expected.
jquery.d.ts(2718,29): error TS1005: ',' expected.
jquery.d.ts(2741,33): error TS1005: ',' expected.
jquery.d.ts(2741,41): error TS1005: ',' expected.
jquery.d.ts(2754,36): error TS1005: ',' expected.
jquery.d.ts(2754,44): error TS1005: ',' expected.
jquery.d.ts(2761,38): error TS1005: ',' expected.
jquery.d.ts(2761,46): error TS1005: ',' expected.
jquery.d.ts(2796,27): error TS1005: ',' expected.
jquery.d.ts(2796,34): error TS1005: ',' expected.
如果我不包含jquery,它编译得很好(我做了教程并且有效)。这里出了什么问题?
答案 0 :(得分:2)
版本1.3与此版本的jquery.d.ts不兼容。我首先使用旧版本的jquery.d.ts修复它,然后意识到我需要在安装typescript之前更新npm。已安装1.4,现在可以使用。