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
Expected behavior:
A compiler error complaining that the second arg (type boolean) is not assignable to type number, using the first overloaded signature.
I would expect the compiler error to be based on the "most applicable" overload signature. If multiple signatures are equally "applicable", then the order of the signatures should be the tie breaker.
Actual behavior:
A compiler error complaining that the second arg cannot be assigned to type string, using the last overloaded signature. When none of the overload signatures are valid, the compiler seems to always use the last overload signature for creating the error message. This can be very misleading.
In this situation, it is more likely that the developer should be guided toward providing a number as the second arg, because the type of their x variable does not require the second overload signature to be used.
The text was updated successfully, but these errors were encountered:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.6.2
Code
(with all strict compiler options enabled)
Expected behavior:
A compiler error complaining that the second arg (type
boolean
) is not assignable to typenumber
, using the first overloaded signature.I would expect the compiler error to be based on the "most applicable" overload signature. If multiple signatures are equally "applicable", then the order of the signatures should be the tie breaker.
Actual behavior:
A compiler error complaining that the second arg cannot be assigned to type
string
, using the last overloaded signature. When none of the overload signatures are valid, the compiler seems to always use the last overload signature for creating the error message. This can be very misleading.In this situation, it is more likely that the developer should be guided toward providing a
number
as the second arg, because the type of theirx
variable does not require the second overload signature to be used.The text was updated successfully, but these errors were encountered: