pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
742 stars 302 forks source link

Async Iterator Pattern Type Error #3023

Closed c-eiser13 closed 2 months ago

c-eiser13 commented 2 months ago

Major Version

4.x

Minor Version Number

4.0.1

Target environment

SharePoint Framework

Additional environment details

Node 18.19.2 Windows 10 SPFx 1.18.2

Expected or Desired Behavior

Use the async iterator pattern to get items in pages or get all items.

Observed Behavior

When I attempt to use this pattern in a freshly scaffolded SPFx 1.18.2 project, I am getting the below error:

image

If I cast with as any, the code runs fine. I've checked my tsconfig settings and everything looks good there.

Steps to Reproduce

Create new SPFx project, install latest @pnp dependencies and copy the sample code from the async iterator docs.

bcameron1231 commented 2 months ago

Hi, I am unable to reproduce. Have you tried to close out of VS Code and re-open it? I've seen scenarios where VS Code has had trouble interpreting some of our types, but restarting VS Code helps.

I don't have any iterator issues. (SPFx 1.18.2, Node 18) image

c-eiser13 commented 2 months ago

@bcameron1231 thanks for the quick reply, ran into this late on Friday, fairly confident I closed VS code and restarted, even after a pc reboot this am, was still seeing type error until making a modification in tsconfig (changed target, then changed back to original value), saving, then it went away, strange for sure, but all good now. Thanks!

github-actions[bot] commented 2 months ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.