Fields doesn't exist on web

developer sp1 461 Reputation points
2020-11-05T01:23:36.65+00:00

Property 'Fields' does not exist on type 'IWeb' when I'm using PnP Js in SPFX:

const fields = await web.fields();

Is this because of I'm using wrong PnP js version ?

Please help

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,619 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,571 Reputation points
    2020-11-05T08:46:58.087+00:00

    Hi @developer sp1 ,

    Try to make sure Fields is imported correctly like this:

    import { sp, Fields, IFields } from "@pnp/sp/presets/all";  
    

    Reference:

    @pnp/sp/lists


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.