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 following error is reported when calling mod.on('foo'); without narrowing its exact type:
This expression is not callable.
Each member of the union type '(<EventName extends keyof PayloadA>(eventName: EventName) => void) | (<EventName extends keyof PayloadB>(eventName: EventName) => void)' has signatures, but none of those signatures are compatible with each other.
π Expected behavior
Since mod.on('foo') works in all possible branches when narrowing down the type I would expect it to also work without branching and narrowing.
The text was updated successfully, but these errors were encountered:
@jcalz thanks for pointing that out. I have troubles understanding the recommended solution and applying it for my use-case. Iβve posted the question on stackoverflow.
Bug Report
π Search Terms
π Version & Regression Information
Problem happens in all recent versions of typescript.
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The following error is reported when calling
mod.on('foo');
without narrowing its exact type:π Expected behavior
Since
mod.on('foo')
works in all possible branches when narrowing down the type I would expect it to also work without branching and narrowing.The text was updated successfully, but these errors were encountered: