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.

serviceScope={serviceScope from AppContext} Does not pass typescript in SPFx 1.15

See original GitHub issue

Category

[ ] Enhancement

[? ] Bug

[ ?] Question

Version 3.8.1

Using

    const { wpContext } = React.useContext(AppContext);
    const sp:ServiceScope = wpContext.serviceScope;

I get TS error:

TS2322: Type 'import("C:/DATA/Sources/Repos/SPFx15/DpcAllJobsScreen/node_modules/@microsoft/sp-core-library/dist/index-internal").ServiceScope' is not assignable to type 'import("C:/DATA/Sources/Repos/SPFx15/DpcAllJobsScreen/node_modules/@pnp/spfx-property-controls/node_modules/@microsoft/sp-core-library/dist/index-internal").ServiceScope'.
  Types have separate declarations of a private property '_registrations'.
    163 |     const sp:ServiceScope = wpContext.serviceScope;
    164 |     return (
  > 165 |         <LivePersona upn={params.data.RequestFor.Email}  serviceScope={sp}
        |                                                          ^^^^^^^^^^^^

How can I use “LivePersona” with hooks deep in child component? what is “private property '_registrations”

Thanks

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fonbrauzencommented, Jul 15, 2022

@AJIXuMuK any plans, or estimations about when 1.15 will be integrated?

0reactions
fonbrauzencommented, Jul 15, 2022

@Ofer-Gal 2 workarounds:

  1. @microsoft/sp-loader add to dependencies
  2. (a bit of hardcore, which I use when this library behind SPFX) clone this repo, get your control from there, copy to your repo with dependencies and try to get it work, when later on this library catches up with SPFX version you could switch it back to library one.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started - PnP/PnPjs
This library is geared towards folks working with TypeScript but will work ... and can be found in the react-pnp-js-sample project, utilizing SPFx...
Read more >
SPFx: Using React hooks to globally share service scope ...
React hooks can only be used from functional components and not classes. With the SPFx generator creating classes by default and hooks being ......
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