Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 399
Mehul Patel Avatar asked Oct 27 '22 12:10

Mehul Patel


1 Answers

let spy = spyOn<MyComponent, any>(component,'close')
like image 100
mp3846 Avatar answered Oct 29 '22 23:10

mp3846