There are number of ways of creating tagged unions.
type X = { type: A, prop: number } | { type: B, prop: string };
type Y = { type: A, data: { prop: number } } | { type: B, data: { prop: string } };
type Z = ['A', { prop: number }] | ['B', { prop: string }];