尝试使用打字稿创建SharePoint Framework应用程序。我尝试添加Material-ui / core,当我提供它时,会出现很多错误:
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(29,75): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(29,99): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(31,54): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(31,78): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(31,81): error TS1109: Expression expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(31,97): error TS1109: Expression expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(31,122): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(31,130): error TS1128: Declaration or statement expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(31,138): error TS1005: ',' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(44,48): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(44,49): error TS1109: Expression expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(44,50): error TS1109: Expression expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(44,68): error TS1005: '(' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(44,69): error TS1005: ')' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(46,30): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(46,54): error TS1005: ';' expected.
[17:10:51] Error - [tsc] node_modules/@types/prop-types/index.d.ts(46,57): error TS1109: Expression expected.
[17:10:51] Error - 'tsc' sub task errored after 5.66 s
这是我的依赖项:
"dependencies": {
"@material-ui/core": "^3.3.0",
"@microsoft/microsoft-graph-types": "^1.5.0",
"@microsoft/sp-core-library": "1.6.0",
"@microsoft/sp-lodash-subset": "1.6.0",
"@microsoft/sp-office-ui-fabric-core": "1.6.0",
"@microsoft/sp-webpart-base": "1.6.0",
"@types/es6-promise": "0.0.33",
"@types/react": "15.6.6",
"@types/react-dom": "15.5.6",
"@types/webpack-env": "1.13.1",
"office-ui-fabric-react": "5.126.0",
"react": "15.6.2",
"react-dom": "15.6.2"
},
有什么建议吗?
编辑:
我正在运行3.1.3打字稿:
@ type / prop-types:
所以我运行了“ yarn list --depth = 0”,它列出了版本为2.4.2的打字稿。这是在新创建的SPFx项目上。我已经运行“ yarn add typescript @ latest”来更新它。 @ microsoft / sharepoint脚手架是否强制项目使用2.4.2?
查看@ microsoft / sp-tslint-rules / package.json: