angulartypescriptnode-modulesangular-devkit

Typing Errors in TypeScript for @types/node/ts4.8/test.d.ts:876-921


I'm encountering an issue with my TypeScript. I have an Angular 11 application, and when attempting to compile the code, I'm receiving a series of error messages referring to node_modules/@types/node/ts4.8/test.d.ts. Here are some of the error messages:

Error: node_modules/@types/node/ts4.8/test.d.ts:876:25 - error TS2304: Cannot find name 'abstract'. ... Error: node_modules/@types/node/ts4.8/test.d.ts:921:31 - error TS2707: Generic type 'MockFunctionCall<F, ReturnType, unknown, Args>' requires between 3 and 4 type arguments.

I think I need to upgrade my typescipt version but i can not do that because of a dependency to: @angular-devkit/build-angular": "~0.1102.19".(I need to upgrade to angular 12 if I want to upgrade this)

My Configuration:

TypeScript: 4.1.6 Angular: 11 @angular-devkit/build-angular": "~0.1102.19" "webpack": "^5.0.0",

enter image description here when i Do npm ls @types/node

Questions:

How can I resolve these errors without having to upgrade my TypeScript version?

I tried to upgrade my typescript version but got dependency issues.


Solution

  • Angular 11 doesn't not support Typscript 4.8

    Depending on you exact version here is the TS compatibility range :

    angular       typescript
    11.2.x :    >=4.0.0 <4.2.0  
    11.1.x :    >=4.0.0 <4.2.0
    11.0.x :    ~4.0.0