type _Banana = { name: string; }
type _Apple = { name: string; }
type Item = Data.TaggedEnum<{
Apple: _Apple;
Banana: _Banana;
AppleAndBanana: {
apple: _Apple;
banana: _Banana;
};
}>
export const Item = Data.taggedEnum<Item>()
type FromConstructor<T extends Data.Case.Constructor<any, any>> = T extends Data.Case.Constructor<infer U, any> ? U : never;
// PROBLEM: Have to extract the tagged types from the TaggedEnum
export type Apple = FromConstructor<typeof Item.Apple>
export type Banana = FromConstructor<typeof Item.Banana>
export type AppleAndBanana = FromConstructor<typeof Item.AppleAndBanana>
// PROBLEM: InnerApple is the untagged version
type InnerApple = AppleAndBanana['apple']
type _Banana = { name: string; }
type _Apple = { name: string; }
type Item = Data.TaggedEnum<{
Apple: _Apple;
Banana: _Banana;
AppleAndBanana: {
apple: _Apple;
banana: _Banana;
};
}>
export const Item = Data.taggedEnum<Item>()
type FromConstructor<T extends Data.Case.Constructor<any, any>> = T extends Data.Case.Constructor<infer U, any> ? U : never;
// PROBLEM: Have to extract the tagged types from the TaggedEnum
export type Apple = FromConstructor<typeof Item.Apple>
export type Banana = FromConstructor<typeof Item.Banana>
export type AppleAndBanana = FromConstructor<typeof Item.AppleAndBanana>
// PROBLEM: InnerApple is the untagged version
type InnerApple = AppleAndBanana['apple']