Closed jduysen closed 3 months ago
One dumb idea, close and reopen vscode, that does sometimes help.
Slightly smarter idea, are you including the import statement in the same file you show the code or another file? If the import of that location is indirect sometimes the types aren't resolved correctly. We could also have an issue with the typings coming out of the preset but I thought that was working. Can you share your tsconfig.json?
Thanks for the quick reply. I have tried putting the import into the file containing my getSp function but that issues the same error. Here is my tsconfig.json:
{
"compilerOptions": {
"module": "NodeNext",
"target": "es6",
"outDir": "dist",
"rootDir": ".",
"sourceMap": true,
"strict": false,
"moduleResolution": "NodeNext"
}
}
So I looked at your example and changed my tsconfig to match yours and it works now. Thanks for pointing me in the right direction.
{
"compilerOptions": {
"module": "ESNext",
"target": "es6",
"outDir": "dist",
"rootDir": ".",
"sourceMap": true,
"strict": false,
"moduleResolution": "Node"
}
}
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.
What version of PnPjs library you are using
3.x
Minor Version Number
24
Target environment
NodeJS
Additional environment details
I am using Node.js with Typescript and MSAL for authentication.
Question/Request
So I am able to authenticate without issue and if I add //@ts-ignore above
let lists = sp.web.lists()
It executes without issue (I get the list information back. But I am getting an IntelliSense error on 'web' that states 'Property 'web' does not exist on type 'SPFI'.'I am using the follow import, (but have also tried individual imports for web, lists, item, etc.):
import '@pnp/sp/presets/all.js'
Here is my code for creating the spfi object:
Any idea what I can do to get the correct IntelliSense for the library?