-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Not sure if the title makes it super clear what I'm experiencing -- essentially, when using function overloads, where one of the parameters is never
typed in one overload, but has a well-defined type in another overload, two different behaviours can occur:
- If the return type does not depend on the generic, the parameter type appears to be correctly resolved as the well-defined type.
- If the return type does depend on the generic, the parameter type is resolved as
never
. (After further investigation, this might just happen any time the return type isnever
)
This seems to have started happening after the overhaul to overloaded types was released in v0.20.0 -- in the previous version, this inconsistency didn't occur.
My understanding is that given T | never == T
, the parameter type should resolve to whatever the non-never
type is. In any case, I would have expected both of these to return the same thing, but maybe this is a bad expectation.
This is reasonably easy to work around by adding a dummy value that prevents the never
type, so I'm not particularly fussed.