-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tsc errors with SPFx 1.7 unchanged scaffolded project #2934
Comments
Both yarn and pnpm for SPFx 1.7 have issues on my side, but not the same to you. |
Most likely this is related on an inconsistent node and/or npm version. We currently support only node v8 LTS version and not yet v10 with SPFx. Can you share the versions which you are using, so that we can build a consistent repro. Thanks. |
Version details: Node: 8.12.0 I can get it working using NPM (in other words, with no My usual dev box is Windows but I've also tried NPM and Yarn on Linux and the same results happen there too. |
It's an issue specifically with Yarn (not necessarily in Yarn, just with using Yarn and SPFx). We are sorting out the pnpm issue first, which appears to be an underlying issue with tslint ( pnpm/pnpm#1487 ). We'll look at Yarn next to see what's going on. |
FYI, for the PNPM issue, I filed a workaround here: #2916 And opened an issue with tslint: palantir/tslint#4294 Investigating the yarn issue now. |
For this yarn issue, the best way to work around it is to add a resolution to your "resolutions": {
"@types/react": "16.4.2"
} This seems to be a bug with Yarn. It is not deduping the dependencies in the same way as NPM or PNPM would. I filed an issue there: yarnpkg/yarn#6695 |
This issue was appearing since I tried to use any UI React library which requires a higher version of typescript. Then I upgraded typescript with the latest and added some code in gulp.js. But then it does not creating production build ie --ship. |
@DanyalKhawaja which React lib were you using? The SharePoint team has said that the build toolchain SPFx is based on will rev to TypeScript v3.x (and webpack v4.x) in an upcoming release, which should address part of that... |
I had tried Material-UI, Ant Design 2.x and finally Fabric ( which got installed with generator "@microsoft/sp-office-ui-fabric-core": "1.7.1"). I am trying to create Application Customizer in react. My solution works with my own react components, but as soon I start using components from any of the above react library, it starts generating errors after gulp serve or bundle. [16:43:28] Starting subtask 'tsc'... |
I can't speak for Material / Ant, but the Fabric React components included with the React project include shouldn't need any special type declarations. I see the props-types type declarations were updated 2mo ago... unsure if they introduced an issue... |
You are right, after I reinstalled Node, Fabric UI was working fine. |
Got this same error, but was able to resolve it by
|
@tarjeieo shouldn't be necessary to do that. Are you running SPFx v1.7 or 1.7.1? The latter had a fix for resolving some type declarations. |
@andrewconnell I'm running 1.7.1. Do note that this was on my home computer and I've successfully built it earlier on my primary work machine. Might be some other factors in play here... What should be the correct typescript-version in package.json? I can try without the @types/prop-types specified. |
You shouldn't have TypeScript listed in your package.json... it's added to the dep tree by other deps... |
Removing typescript and @prop-types from package.json causes this error to appear again during gulp.... This is how my package.json looks like, see anything stinky?
|
@tarjeieo This is forking from the OP's issue... can you open a new issue as it's hard to follow what the error is that you're having now. Having a repro'd project (linked to in a public repo) would be helpful. |
I'm just trying to add more context to this issue, since I'm getting the exact same errors as OP as far as I can tell. But as mentioned earlier, I cannot reproduce on my work computer so it looks like an env. issue of some sort. |
I am having the same error too where I didn't set any package manager and simply did
|
@warmjaijai Please create a new issue & provide additional information on your context (versions of things installed)... the issue appears resolved from the OP. |
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 |
Category
Expected or Desired Behavior
Workbench page launches with ability to add web part.
Observed Behavior
Workbench page is blank. Console shows error messages:
Steps to Reproduce
Accept all the defaults from
yo
but include React as a library.EDIT: Seems to work when using
pnpm
as package manager.The text was updated successfully, but these errors were encountered: