You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to test some code that i wrote with SVG.js. I need to use jest.toHaveBeenCalledWith() to see if specific circle methods have been called with the correct params. Unfortunately, .circle() is an overloaded function. TS does not know what is the correct overloaded function one to spy on. So by default it always chooses the last signature known.
There are many posts on the internet that describe the issue like:
The recommended standard is for the most general signature to be the last one. Unfortunately, .circle() with just the size param is not the last one, even though it is the more general one, causing jest to choose the wrong overload in my tests. I managed to workaround it with the 2nd link above, but it's not the greatest of solution.
In might be beneficial to check the typings and make sure that the most general overloaded signature is always the last one.
The text was updated successfully, but these errors were encountered:
sorry for the late response. Feel free to create a PR to adapt the typings to your needs. If there is a better way of writing it, a PR is absolutely welcome!
I want to test some code that i wrote with SVG.js. I need to use jest.toHaveBeenCalledWith() to see if specific circle methods have been called with the correct params. Unfortunately, .circle() is an overloaded function. TS does not know what is the correct overloaded function one to spy on. So by default it always chooses the last signature known.
There are many posts on the internet that describe the issue like:
The recommended standard is for the most general signature to be the last one. Unfortunately, .circle() with just the size param is not the last one, even though it is the more general one, causing jest to choose the wrong overload in my tests. I managed to workaround it with the 2nd link above, but it's not the greatest of solution.
In might be beneficial to check the typings and make sure that the most general overloaded signature is always the last one.
The text was updated successfully, but these errors were encountered: