expect-type icon indicating copy to clipboard operation
expect-type copied to clipboard

support overloaded functions

Open y-polonsk opened this issue 2 years ago • 2 comments

Currently, the constructs like expectTypeOf.toBeCallableWith, expectTypeOf.parameters, expectTypeOf.parameter do not work with function overloads. Basically they just assume the signature of the last overload and give error otherwise.

I believe this could be made work, doing something similar to what is described here:

https://stackoverflow.com/questions/59535995/parameters-generic-of-overloaded-function-doesnt-contain-all-options/59538756#59538756

Although, for expectTypeOf.parameter, I m not sure how to refer to a parameter at given index for specific overload. But i believe "toBeCallableWith" and "parameters" could be made work.

Thanks.

y-polonsk avatar May 03 '23 04:05 y-polonsk

Oh that's an interesting workaround. Yes, I'd be open to adding that. Let me know if you would like to create a PR. There are some big-ish perf changes in flux right now, but this would probably be separate enough that it doesn't affect them.

mmkal avatar May 03 '23 13:05 mmkal

@mmkal I'm gonna give this a shot!

aryaemami59 avatar Mar 16 '24 10:03 aryaemami59