Im trying to get some conditional typing to work and not sure if what Im thinking is possible to do or not. Here it goes:
type AParams = {
hello: string
}
type BParams = {
world: string
}
type Data = {
name: "a" | "b",
data: AParams | BParams
}
Depending on name being a or b I want to enforce the data to either have type AParams or BParams, respectively. Any way this can be accomplished with TypeScript?