How to express mixed ad-hoc and parametric polymorphic in typescript?
问题 I'm not sure if I'm describing the questing currently in the title. What I'm trying to ask comes from the following requirement. I'm trying to make an abstract for states of finite state machines and comes up with the following definition (in typescript) interface IState { send<T, E>(message: T, callback?:(event: E)=>void): IState; } I'm trying to express that a state of the finite state machine should be able to accept messages and return new state, with an optional callback to handle event