Pages

Saturday, November 5, 2022

Type 'WebPartContext' is not assignable to type 'ISPFXContext' error in SPFX

Problem 

Getting an error when trying to create spfxContext in SPFx framework. At that time getting the below error. 

Type 'WebPartContext' is not assignable to type 'ISPFXContext'.
The types of 'msGraphClientFactory.getClient' are incompatible between these types.
Type '(version: "3") => Promise<MSGraphClientV3>' is not assignable to type '() => Promise<any>'





Solution

spfxContext: this.context as any



Tuesday, November 1, 2022

Warnings messages lead to fail the SharePoint Framework build process

Problem Background

I was trying to build a SPFx solution using the command gulp bundle --ship.
I was getting lot of warning and the build is getting failed. Image attached below.



Solution
Instruct the gulp to ignore the warnings when building the solution. 
For that you have to add build.addSuppression(/Warning/gi);in gulpfile.js