Skip to content

Impossible type generated for tagged enum variant with anonymous field #24

Closed as not planned
@link2xt

Description

@link2xt

I have tried adding this test:

diff --git a/tests/test.rs b/tests/test.rs
index cc14ae8..5480c3a 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -246,6 +246,7 @@ export type Test10=({"type":"A";"value":(types.Parent&{"a":string;"b":types.Usiz
                 B(Inner),
                 // C(Inner, Inner), // not allowed
                 D,
+                E(i64),
             }
 
             assert_eq_str!(

This results in generation of the following type:

export type I64=number;
export type Test=(({"type":"A";}&{"a":types.Inner;})|({"type":"B";}&types.Inner)|{"type":"D";}|({"type":"E";}&types.I64));

Type ({"type":"E";}&types.I64) does not look like something possible to construct.

This is a minimal example of what I am trying to do at chatmail/core#4602

No idea how this type should look like, maybe should not be allowed similar to C.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions