【发布时间】:2016-02-21 20:22:57
【问题描述】:
我正在尝试将 react 与带有 reactjs 的 typescript 一起使用,现在 typescript 在我从 github 获得的 react.d.ts 文件上抛出语法错误: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/react
错误基本是这样的。
file_path/react.d.ts(6,9):
>> error TS1005: ';' expected.
file_path/react.d.ts(6,19):
>> error TS1005: ';' expected.
file_path/react.d.ts(6,27):
>> error TS1005: ';' expected.
file_path/react.d.ts(11,51):
>> error TS1003: Identifier expected.
file_path/react.d.ts(13,5):
>> error TS1008: Unexpected token; 'statement' expected.
我将我的 typescript 版本升级到最新的 1.6.2,因为其他人认为可能是问题所在,但它仍然存在。
这是一个正在进行的大型项目,一直在使用 typescript,它只是它不喜欢的 react.d.ts 文件。
我可以尝试哪些其他方法使 typescript 接受定义文件?
【问题讨论】:
标签: javascript reactjs typescript