0

Trying to create a SharePoint Framework app with in typescript. I try to add Material-ui/core, and when I go to serve it, I get lots of errors:

[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

Here are my Dependencies:

  "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"
  },

Any suggestions?

EDIT:

I'm running 3.1.3 typescript:

enter image description here

@type/prop-types:

enter image description here

So I ran "yarn list --depth=0" and it lists typescript at version 2.4.2. This was on a newly created SPFx project. I've run "yarn add typescript@latest" to update it. Is the @microsoft/sharepoint scaffolding forcing the project to use 2.4.2?

Looking at @microsoft/sp-tslint-rules/package.json:

enter image description here

Holden1515
  • 659
  • 2
  • 7
  • 20
  • What version of typescript do you have installed. The definitions probably require a newer version of ts than the one you have – Titian Cernicova-Dragomir Oct 22 '18 at 22:41
  • 1
    To use your current version of `@types/prop-types`, you need to use TypeScript 2.8 or newer, which may not be possible with the SharePoint Framework. See [this thread](https://stackoverflow.com/q/52925657) for potential alternatives. – Matt McCutchen Oct 22 '18 at 22:45
  • Sorry, I am running typescript 3.1.3. I'll update. – Holden1515 Oct 23 '18 at 13:02

0 Answers0