sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,67): error TS1005: ';' expected.

Open chinthaka321 opened this issue 7 years ago • 8 comments

Ah. Bug in the docs. The problem is that OUIFR is being referenced, but there is no explicit reference in package.json, so it's picking up an incompatible ambient type.

Can you add "office-ui-fabric-react": "6.143.0" to the dependency section of your package.json file, rerun npm install, then rebuild?

Originally posted by @patmill in https://github.com/SharePoint/sp-dev-docs/issues/3622#issuecomment-474526941

chinthaka321 avatar Mar 22 '19 01:03 chinthaka321

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Mar 22 '19 01:03 msft-github-bot

I tried above but still i'm getting error [11:58:52] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,67): error TS1005: ';' expected. [11:58:52] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,114): error TS1005: '(' expected. [11:58:52] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,136): error TS1005: '(' expected. [11:58:52] Error - 'tsc' sub task errored after 3.06 s

chinthaka321 avatar Mar 22 '19 01:03 chinthaka321

package.json? And did you run npm install after updating it to reference office-ui-fabric-react?

patmill avatar Mar 22 '19 03:03 patmill

This is my package.json. Yes I did npm install { "name": "office-fabric-ui", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "react": "16.7.0", "react-dom": "16.7.0", "@types/react": "16.4.2", "@types/react-dom": "16.0.5", "@microsoft/sp-core-library": "1.8.0", "@microsoft/sp-property-pane": "1.8.0", "@microsoft/sp-webpart-base": "1.8.0", "@microsoft/sp-lodash-subset": "1.8.0", "@microsoft/sp-office-ui-fabric-core": "1.8.0", "@types/webpack-env": "1.13.1", "@types/es6-promise": "0.0.33", "office-ui-fabric-react": "6.143.0" }, "resolutions": { "@types/react": "16.4.2" }, "devDependencies": { "@microsoft/sp-build-web": "1.8.0", "@microsoft/sp-tslint-rules": "1.8.0", "@microsoft/sp-module-interfaces": "1.8.0", "@microsoft/sp-webpart-workbench": "1.8.0", "@microsoft/rush-stack-compiler-2.7": "0.4.0", "gulp": "~3.9.1", "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "ajv": "~5.2.2" } }

chinthaka321 avatar Mar 22 '19 03:03 chinthaka321

Hi, got the same error. Upgrading the project from using TypeScript 2.7 to 3.2 fixed that. You can find a very good explanation of the upgrade process on Elio's Blog: https://www.eliostruyf.com/using-the-full-potential-of-react-in-sharepoint-framework-1-8-0/ Generally speaking we fixed a lot of different compile errors we got in solutions upgraded to SPFx 1.8 simply by upgrading Typescript from 2.7 to 3.2. In our experience so far it seems to be a bad choice using 2.7 as default for SPFx 1.8.

cwdata avatar Mar 22 '19 15:03 cwdata

My appologies. I tested this against TS 2.9. not 2.7. In order to stick with TS 2.7, you need to reference office-ui-fabric-react version 5.132.0

I've double checked and built correctly with this. Bumping up the version of the build tools to 2.9 will also solve the problem. I've updated the backing documentation to reflect this. Need to figure out why it is not rolling to the official site. Can you confirm that changing the fabric react version fixes the issue?

patmill avatar Mar 22 '19 16:03 patmill

Thank you Pat, Yes it worked. This is my new package json. { "name": "office-fabric-ui", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "react": "16.7.0", "react-dom": "16.7.0", "@types/react": "16.4.2", "@types/react-dom": "16.0.5", "@microsoft/sp-core-library": "1.8.0", "@microsoft/sp-property-pane": "1.8.0", "@microsoft/sp-webpart-base": "1.8.0", "@microsoft/sp-lodash-subset": "1.8.0", "@microsoft/sp-office-ui-fabric-core": "1.8.0", "@types/webpack-env": "1.13.1", "@types/es6-promise": "0.0.33", "office-ui-fabric-react": "5.132.0" }, "resolutions": { "@types/react": "16.4.2" }, "devDependencies": { "@microsoft/sp-build-web": "1.8.0", "@microsoft/sp-tslint-rules": "1.8.0", "@microsoft/sp-module-interfaces": "1.8.0", "@microsoft/sp-webpart-workbench": "1.8.0", "@microsoft/rush-stack-compiler-2.7": "0.4.0", "gulp": "~3.9.1", "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "ajv": "~5.2.2" } }

chinthaka321 avatar Mar 23 '19 23:03 chinthaka321

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 25 '20 00:01 msft-github-bot