我相信我的设置正确,但正在努力让tsc进行编译。
我的回购分支是https://github.com/inosion/sample-atom-typescript-package/tree/add_react
我拥有最新版本的打字稿-但不确定我在做什么错-node_modules/@types/prop-types/index.d.ts(12,46): error TS1005: ';' expected.
等
✔ ~/projects/internal/github.com/inosion/sample-atom-typescript-package [master|✚ 3]
18:34 $ grep dependencies -A 10 package.json
"dependencies": {
"typescript": "2.3",
"@types/atom":"*",
"@types/react":"*",
"@types/react-native":"*"
}
}
✔ ~/projects/internal/github.com/inosion/sample-atom-typescript-package [master|✚ 3]
18:34 $ tsc --version
Version 2.7.2
✔ ~/projects/internal/github.com/inosion/sample-atom-typescript-package [master|✚ 3]
18:34 $ apm clean
✔ ~/projects/internal/github.com/inosion/sample-atom-typescript-package [master|✚ 3]
18:34 $ tsc --project .
node_modules/@types/prop-types/index.d.ts(12,46): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(12,75): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(12,99): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(14,54): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(14,78): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(14,81): error TS1109: Expression expected.
node_modules/@types/prop-types/index.d.ts(14,97): error TS1109: Expression expected.
node_modules/@types/prop-types/index.d.ts(14,122): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(14,130): error TS1128: Declaration or statement expected.
node_modules/@types/prop-types/index.d.ts(14,138): error TS1005: ',' expected.
node_modules/@types/prop-types/index.d.ts(27,48): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(27,49): error TS1109: Expression expected.
node_modules/@types/prop-types/index.d.ts(27,50): error TS1109: Expression expected.
node_modules/@types/prop-types/index.d.ts(27,68): error TS1005: '(' expected.
node_modules/@types/prop-types/index.d.ts(27,69): error TS1005: ')' expected.
node_modules/@types/prop-types/index.d.ts(29,30): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(29,54): error TS1005: ';' expected.
node_modules/@types/prop-types/index.d.ts(29,57): error TS1109: Expression expected.
node_modules/@types/react/index.d.ts(2293,27): error TS1005: ';' expected.
node_modules/@types/react/index.d.ts(2294,14): error TS1005: ':' expected.
node_modules/@types/react/index.d.ts(2294,28): error TS1005: ';' expected.
node_modules/@types/react/index.d.ts(2295,9): error TS1109: Expression expected.
node_modules/@types/react/index.d.ts(2296,9): error TS1005: '(' expected.
node_modules/@types/react/index.d.ts(2297,9): error TS1005: '(' expected.
node_modules/@types/react/index.d.ts(2298,5): error TS1005: '(' expected.
node_modules/@types/react/index.d.ts(2298,12): error TS1005: ')' expected.
node_modules/@types/react/index.d.ts(2310,49): error TS1005: ';' expected.
node_modules/@types/react/index.d.ts(2310,76): error TS1005: ';' expected.
node_modules/@types/react/index.d.ts(2310,99): error TS1005: ';' expected.
node_modules/@types/react/index.d.ts(2311,13): error TS1128: Declaration or statement expected.
node_modules/@types/react/index.d.ts(2312,13): error TS1005: '(' expected.
node_modules/@types/react/index.d.ts(2312,17): error TS1005: ',' expected.
node_modules/@types/react/index.d.ts(2312,44): error TS1005: ',' expected.
node_modules/@types/react/index.d.ts(2312,45): error TS1005: ':' expected.
node_modules/@types/react/index.d.ts(2314,17): error TS1005: '(' expected.
node_modules/@types/react/index.d.ts(2314,21): error TS1005: ',' expected.
node_modules/@types/react/index.d.ts(2314,51): error TS1005: ',' expected.
node_modules/@types/react/index.d.ts(2314,52): error TS1005: ':' expected.
node_modules/@types/react/index.d.ts(2316,21): error TS1005: '(' expected.
node_modules/@types/react/index.d.ts(2316,24): error TS1005: ')' expected.
答案 0 :(得分:1)
您遇到的第一个错误是带有条件类型的行(introduced in typescript 2.8),因此这表明您没有最新版本(在撰写本文时为3.0)
如果查看输出,您还将清楚地看到:
18:34 $ tsc --version
Version 2.7.2
因此使用的版本为2.7
,不支持定义中使用的功能。