question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Category

[ ] Enhancement

[ ] Bug

[X] Question

Version

Please specify what version of the library you are using: [ 3.0.0 ]

Expected / Desired Behavior / Question

Before 3.0.0 the context={props.context} for FilePicker and ListItemPicker was OK with WebPartContext inherited from the context: this.context from the web part class.

Observed Behavior

After upgrade to 3.0.0 , TS complains that “Type ‘WebPartContext’ is not assignable to type ‘BaseComponentContext’.”

I am OK for now by using context={props.context as any} But I would like to know the right way to do it.

Thanks for a great collection!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:29 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
jonsjonssoncommented, Nov 25, 2021

I was getting this on the PropertyFieldColumnPicker and this worked for me to get past this error. context: this.context as any,

5reactions
Ofer-Galcommented, Oct 23, 2021

@pnp/spfx-controls-react”: “3.4.0”, with SPFx 1.13.0 shows the same typescript error 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

BaseComponentContext class - Microsoft Learn
Each component type has its own specialized subclass of BaseComponentContext, e.g. WebPartContext for web parts, ExtensionContext for client-side extensions ...
Read more >
PNP PeoplePicker Type 'WebPartContext' is missing the ...
I am using spfx Peoplepicker control in my spfx react webpart solution but Peoplepicker control encountering the below error. Error : Type ' ......
Read more >
PeoplePicker - @pnp/spfx-controls-react
Property Type Required Default context BaseComponentContext yes titleText string no groupName string no none
Read more >
SPFx Extension - Page Context is missing
No its not removed or deprecated. Its working correctly . Just upgraded a sample and was able to work with the this.context object...
Read more >
https://unpkg.com/@microsoft/sp-application-base@1...
@remarks * Third parties should not call this constructor. ... Excluded from this release type: _initializeExtensionType */ /** * {@inheritDoc ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found