1

New to pnpjs, using 8.15.0 trying to get a list of lists in a SPFx.

I'm getting error: TypeError: this.sp.web.lists.get is not a function. I have list item updates working in this same ts file. Assuming I am missing an import, can anyone advise.

import { spfi, SPFx } from "@pnp/sp"; //"@pnp/sp/presets/all" //
import "@pnp/sp/webs";
import "@pnp/sp/lists";
import "@pnp/sp/items";
import "@pnp/sp/files";
import "@pnp/sp/folders";
import { IField, IFieldAddResult, FieldTypes, IFieldInfo } from "@pnp/sp/fields/types";
import "@pnp/sp/lists/web";
import "@pnp/sp/fields";
import "@pnp/sp/items/get-all";
import {Web, IWeb} from "@pnp/sp/presets/all";

...

const lists: any[] = await sp.web.lists.filter('Hidden eq false').get();

2 Answers 2

1

There is no .get() since version 3 as far as I remember:

const lists: any[] = await sp.web.lists.filter('Hidden eq false')();
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I was looking at old documents
1

You don't need to use the get with the latest versions of the PnP JS library.

You can just use () instead of get().

You can follow the official PnP JS documentation for more information and examples: @pnp/sp/lists

1 Comment

Thanks, I was looking at old documents

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.