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
The above code typechecks! f's type is displayed as never, but it behaves like (...args: any[]) => any.
🙂 Expected behavior
f should either be a real never (and therefore not be callable), or be callable with the specified call signature ((x: string) => number). Probably the former?
This occurs when intersecting a type that has a call signature with another incompatible type, and only if the incompatibility involves a literal type (i.e. when it's a discriminant).
Based on the behavior and affected versions, this is likely related to #36696.
Bug Report
🔎 Search Terms
call never, callable intersection, intersection call signature, intersection discriminant
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
The above code typechecks!
f
's type is displayed asnever
, but it behaves like(...args: any[]) => any
.🙂 Expected behavior
f
should either be a realnever
(and therefore not be callable), or be callable with the specified call signature ((x: string) => number
). Probably the former?This occurs when intersecting a type that has a call signature with another incompatible type, and only if the incompatibility involves a literal type (i.e. when it's a discriminant).
Based on the behavior and affected versions, this is likely related to #36696.
Elaborated playground with commentary and more examples
The text was updated successfully, but these errors were encountered: