Hi
Two compile error when using node 15, please help, thanks
node_modules/node-sp-auth/node_modules/got/dist/source/types.d.ts:205:83 - error TS2709: Cannot use namespace 'PCancelable' as a type.
205 export interface CancelableRequest<T extends Response | Response['body']> extends PCancelable<T>, GotEvents<CancelableRequest<T>> {
~~~~~~~~~~~
src/index.ts:61:5 - error TS2339: Property 'web' does not exist on type 'SPRest'.
61 sp.web.webinfos.get().then((lists: any) => {
node_modules/node-sp-auth/node_modules/got/dist/source/types.d.ts:205:83 - error TS2709: Cannot use namespace 'PCancelable' as a type.
205 export interface CancelableRequest<T extends Response | Response['body']> extends PCancelable<T>, GotEvents<CancelableRequest<T>> {
Got and node-sp-auth libraries do not correlate with PnPjs directly.
Such TypeScript errors are common when local TS settings/version is different from the one used in the library. Should be forced to ignore in tsconfig.json by setting skipLibCheck:
{
"compilerOptions": {
"skipLibCheck": true
}
}
src/index.ts:61:5 - error TS2339: Property 'web' does not exist on type 'SPRest'.
61 sp.web.webinfos.get().then((lists: any) => {
Seems that you imported @pnp/sp [-commonjs] only without importing web API methods, please check selective import docs article for details, also, in a Node application it's simpler to use presets:
import { sp } from '@pnp/sp-commonjs/presets/all';
Going to close this.
Most helpful comment
Got and node-sp-auth libraries do not correlate with PnPjs directly.
Such TypeScript errors are common when local TS settings/version is different from the one used in the library. Should be forced to ignore in
tsconfig.jsonby settingskipLibCheck:Seems that you imported
@pnp/sp[-commonjs] only without importingwebAPI methods, please check selective import docs article for details, also, in a Node application it's simpler to use presets: