0

I've been asked to make changes to a TypeScript project and compile it to get a new JavaScript file. The JavaScript file is just to be referenced from a SharePoint site, so there's no SPFx involved here.

I downloaded the project from our TFS and did an "npm install" to get the node modules and that worked fine.

When I try to build it using "npm run-script build" I get a bunch of errors regarding sp-pnp-js. According to package.json, this is the version referenced:

"sp-pnp-js": "^2.0.5"

See the errors below. I'm completely at a loss here and I don't understand the errors. I know that the code is okay, so this is something wrong in my dev environment. What am I missing? Please help.

ERROR in [at-loader] ./node_modules/sp-pnp-js/lib/sharepoint/attachmentfiles.d.ts:71:5
    TS2416: Property 'delete' in type 'AttachmentFile' is not assignable to the same property in base type 'QueryableInstance'.
  Type '(eTag?: string) => Promise<void>' is not assignable to type '(deleteOptions?: FetchOptions, parser?: ODataParser<any>) => Promise<any>'.
    Types of parameters 'eTag' and 'deleteOptions' are incompatible.
      Type 'FetchOptions' is not assignable to type 'string'.

ERROR in [at-loader] ./node_modules/sp-pnp-js/lib/sharepoint/files.d.ts:114:5
    TS2416: Property 'delete' in type 'File' is not assignable to the same property in base type 'QueryableShareableFile'.
  Type '(eTag?: string) => Promise<void>' is not assignable to type '(deleteOptions?: FetchOptions, parser?: ODataParser<any>) => Promise<any>'.
    Types of parameters 'eTag' and 'deleteOptions' are incompatible.
      Type 'FetchOptions' is not assignable to type 'string'.

ERROR in [at-loader] ./node_modules/sp-pnp-js/lib/sharepoint/files.d.ts:286:5
    TS2416: Property 'delete' in type 'Version' is not assignable to the same property in base type 'QueryableInstance'.
  Type '(eTag?: string) => Promise<void>' is not assignable to type '(deleteOptions?: FetchOptions, parser?: ODataParser<any>) => Promise<any>'.
    Types of parameters 'eTag' and 'deleteOptions' are incompatible.
      Type 'FetchOptions' is not assignable to type 'string'.

ERROR in [at-loader] ./node_modules/sp-pnp-js/lib/sharepoint/folders.d.ts:81:5
    TS2416: Property 'delete' in type 'Folder' is not assignable to the same property in base type 'QueryableShareableFolder'.
  Type '(eTag?: string) => Promise<void>' is not assignable to type '(deleteOptions?: FetchOptions, parser?: ODataParser<any>) => Promise<any>'.
    Types of parameters 'eTag' and 'deleteOptions' are incompatible.
      Type 'FetchOptions' is not assignable to type 'string'.

ERROR in [at-loader] ./node_modules/sp-pnp-js/lib/sharepoint/items.d.ts:112:5
    TS2416: Property 'delete' in type 'Item' is not assignable to the same property in base type 'QueryableShareableItem'.
  Type '(eTag?: string) => Promise<void>' is not assignable to type '(deleteOptions?: FetchOptions, parser?: ODataParser<any>) => Promise<any>'.
    Types of parameters 'eTag' and 'deleteOptions' are incompatible.
      Type 'FetchOptions' is not assignable to type 'string'.

ERROR in [at-loader] ./node_modules/sp-pnp-js/lib/sharepoint/lists.d.ts:151:5
    TS2416: Property 'delete' in type 'List' is not assignable to the same property in base type 'QueryableSecurable'.
  Type '(eTag?: string) => Promise<void>' is not assignable to type '(deleteOptions?: FetchOptions, parser?: ODataParser<any>) => Promise<any>'.
    Types of parameters 'eTag' and 'deleteOptions' are incompatible.
      Type 'FetchOptions' is not assignable to type 'string'.
  • No takers? I still have this issue. I anyone has a clue, please let me know. – Papageno Aug 30 '20 at 19:39
2

I finally got this working. I deleted the node modules and run npm install to retrieve the modules according to package.json. I did try that several times before still getting the same error, but this time I added this command:

npm install --save-dev typescript

I'm pretty sure I did that too at some point before, but this time everything started working. Maybe typescript didn't install properly the first time.

Anyway, my issue is solved but I leave my question and answer to anyone having the same issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.