Type ‘WebPartContext’ is not assignable to type ‘BaseComponentContext’

While working with the SharePoint Framework (SPFx) web part with the PnP Property Pane controls, particularly those that use the context property, you might see an error like this:

Type 'WebPartContext' is not assignable to type 'BaseComponentContext'.
How to fix Type WebPartContext is not assignable to type BaseComponentContext.

This can happen after updating Node.js and SPFx to the latest versions. After doing some research, I found a solution that fixed the issue.

In this article, I will explain how to solve this error: Type ‘WebPartContext’ is not assignable to type ‘BaseComponentContext’.

Check out SPFx Property Pane Controls

Type ‘WebPartContext’ is not assignable to type ‘BaseComponentContext’ – Fixes

Problem: Before I updated my Node.js to version 22.17.0 and SPFx to version 1.21.1, I had no issues using the PnP Property Pane controls.

But after the update, when I tried to use the controls below, I got the issue.

  • PropertyFieldListPicker control,
  • PropertyFieldColumnPicker control,
  • PropertyFieldFilePicker control, etc.

These controls use the context property to get data from the current site. After the update, the WebPartContext could no longer be used directly, and it displayed the error ‘WebPartContext is not assigned to the BaseComponentContext’.

Solution: On the official PnPSPFxPropertyPaneControls page, it is mentioned that if we are using the PnP controls version 3, which is based on SPFx v1.12 and above, we must cast the web part context to any type to pass it to the controls as below.

PropertyFieldListPicker('lists', {
      label: 'Select a list',
      selectedList: this.properties.lists,
      includeHidden: false,
      orderBy: PropertyFieldListPickerOrderBy.Title,
      disabled: false,
      onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
      properties: this.properties,
      context: this.context as any,
      deferredValidationTime: 0,
      key: 'listPickerFieldId'
 })
Type 'WebPartContext' is not assignable to type 'ISPFXContext' error in SPFX

This solves my problem, and even the web part is working fine, allowing me to use those PnP Property Pane controls. In the example below, you can see that I used the list picker, column picker, people picker controls, etc., which have a context property; after updating, it is working fine.

PNP PeoplePicker Type 'WebPartContext' is missing the following properties from type 'BaseComponentContext'

I hope you found this article helpful. In this article, I have explained how to fix the error ” Type ‘WebPartContext’ is not assignable to type ‘BaseComponentContext’. Follow this article if you are also facing the same issue while working with PnP property pane controls in SPFx web part.

Also, you may like:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Live Webinar

Quiz App Using SharePoint Framework (SPFx)

Learn to built a complete Quiz Management solution that enables admins to create and manage quizzes, categories, questions, and settings with an easy automated setup process in SharePoint. It also includes an interactive quiz experience for users and a powerful dashboard to track participation, analyze results, and view detailed performance reports with charts and answer insights.

📅 2nd June 2026 – 10:00 AM EST | 7:30 PM IST

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App