During the upgrade to Angular 11, several other packages, such as jasmine-core, were also upgraded. This caused lint issues when running the 'npm run test' command due to stricter type definitions.
One specific issue involves the window.scrollBy() method. According to the type definition file (lib.dom.ts), it can have two overloaded implementations as shown below:
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
However, when writing a unit test case, a lint error is encountered:
it('should scroll down by 10 units', fakeAsync(() => {
service.scrollDown(10);
expect(window.scrollBy).toHaveBeenCalledWith({
top: 10,
left: 0,
behavior: 'smooth',
});
}));
https://i.sstatic.net/jCLY5.png
It appears that only the second overloaded implementation is being considered, ignoring the first one where only the "options" parameter can be passed. Despite this, the test case passes successfully.
I have provided a minimal reproduction example on the following Github link. Any additional information required is appreciated. Any assistance or guidance would be welcomed.