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
While working on #29011 I realized that the error we produce for unions of things which look callable but for which we cannot synthesize a signature for are lackluster. We report an error like:
Cannot use 'new' with an expression whose type lacks a call or construct signature.
when we could do better and say something like
Cannot use 'new' with an expression whose type lacks a call or construct signature. All members of union type {0} have call or construct signatures, but none are similar enough to resolve a call in a typesafe way.
which would make it far more clear what's going on in these scenarios.
Once #29011 is merged, the conditions can be even more specific, such as
Cannot use 'new' with an expression whose type lacks a call or construct signature. All members of union type {0} have call or construct signatures, but more than one has overloads, which prevents this call from being resolved in a typesafe way.
and
Cannot use 'new' with an expression whose type lacks a call or construct signature. All members of union type {0} have call or construct signatures, but more than one has type parameters, which prevents this call from being resolved in a typesafe way.
While working on #29011 I realized that the error we produce for unions of things which look callable but for which we cannot synthesize a signature for are lackluster. We report an error like:
when we could do better and say something like
which would make it far more clear what's going on in these scenarios.
Once #29011 is merged, the conditions can be even more specific, such as
and