Skip to content

Non-object record types are converted to objects #68

Description

@OliverJAsh
import { ofType, unionize, UnionOf } from 'unionize';

const MyUnion = unionize({
    MyVariant: ofType<string[]>(),
});
type MyUnion = UnionOf<typeof MyUnion>;

MyUnion.match({
    MyVariant: strs => strs.map(x => x), // runtime error!
});

Related: #67

Workaround: specify a value:

 const MyUnion = unionize({
     MyVariant: ofType<string[]>(),
-});
+}, { value: 'value' });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions