Effect CommunityEC
Effect Community2y ago
22 replies
joepjoosten

Schema.Schema.Type Returning Simplify

Why does Schema.Schema.Type give back Simplify?

const Test = <T extends Schema.Schema.All>(data: T) =>Schema.Union(Schema.Struct({
  a: Schema.String,
  data
}), Schema.Struct({ b: Schema.String}))

export type Test<T extends Schema.Schema.All> = Schema.Schema.Type<ReturnType<typeof Test<T>>>
/*
Output type:
type Test<T extends Schema.Schema.All> = Simplify<Schema.Struct.Type<{
    a: Schema.$String;
    data: T;
}>> | {
    readonly b: string;
}
*/
Was this page helpful?