Search code examples
spfx

What is the equivalent of ItemAddResult in @pnp/sp?


I'm getting 'node_modules/@pnp/sp has no exported member 'ItemAddResult'' when I'm importing ItemAddResult at the top of a SharePoint Sfpx webpart:

import { sp, ItemAddResult, AttachmentFileInfo } from "@pnp/sp";

I'm also getting the same message for: AttachmentFileInfo.

In the docs it suggests to import ItemAddResult: https://pnp.github.io/pnpjs/v1/sp/docs/items/#add-items

Now that the old sp-pnp-js library has been deprecated, I'm forced(?) to use this new library.

I've run npm install on the project dir.

Any guidance appreciated.


Solution

  • Since v2 use import { IItemAddResult } from "@pnp/sp/items";

    Please have a look to the docs: Add Items