You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect this to work. However, aorbStruct shows a TS error:
TS2322: Type Struct<A | B, null> is not assignable to type Describe<A | B>
Types of property schema are incompatible.
Type null is not assignable to type
{
a: Describe<"a">;
} | {
b: Describe<"b">;
}
The strange thing is that it works once I include a primitive in the union:
I have a gut feeling this is because any expansion of a union needs to be simplified, something like Describe<OriginalUnion> | Describe<undefined> => Describe<OriginalUnion | undefined> ?
Hi everyone,
I stumbled across a seemingly simple example where
Describe
does not work well withunion
. However, it might be I am missing something.Consider the following:
I would expect this to work. However,
aorbStruct
shows a TS error:The strange thing is that it works once I include a primitive in the union:
works fine.
Could you please
const aorbStruct: Describe<A | B> = union([aStruct, bStruct]);
case workingThank you!
The text was updated successfully, but these errors were encountered: