Search code examples
angulartypescriptjasmine

Angular Jasmine - Argument of type 'string' is not assignable to parameter of type 'never' error in typescript


I am writing test cases in Angular using Jasmine 3.6.0 and typescript 4.1.5 with "strict": false in tsconfig.json file

I wanted to spyOn component method called 'close' and as per syntax I wrote below code

let spy = spyOn<MyComponent>(component,'close');

It was working fine but after copying source code to different folder I installed node modules and it started giving below error

'Argument of type 'string' is not assignable to parameter of type 'never''

I know this question is asked many times and I tried those solutions but I am facing same error. I don't understand what is the actual problem as my strict mode is also off.


Solution

  • let spy = spyOn<MyComponent, any>(component,'close')