Structured messaging followup
In my previous article I defined message types using TypeScript’s type alias facility. It turns out that interface extension is better here as it allows you to define recursive types where aliases do not. Simple change:
export type FooBar = IMessage<FooBarKeyT, {v: number}>;
becomes
export interface FooBar extends IMessage<FooBarKeyT, {v: number}> { }
The unioned types – such as `FooMessage` stay the same.
The Interfaces vs. Type Aliases section of the Advanced Types chapter in the TypeScript Handbook covers this briefly.