Modeling Annoying State with Minimal Schemas
How do I model annoying state like the following:
in the least amount of schemas?
in the least amount of schemas?
type DataFoo = {
type: "Foo",
number: number,
data: Foo
}
type DataBar = {
type: "Bar",
number: number,
data: Bar
}
type Data = DataFoo | DataBase
type GenericData = {
type: "Foo" | "Bar"
number: number
data: Foo | Bar
}