jburzynski / TypeGen

Single-class-per-file C# to TypeScript generator
MIT License
197 stars 56 forks source link

TsTypeUnion only works in top level export #173

Open halsandr opened 1 year ago

halsandr commented 1 year ago

I am finding that the [TsTypeUnions] attribute only works when it is in an interface that has [ExportTsInterface], if it is on a dependant type, then the union is ignored.


Controller.cs

    [ExportTsInterface]
    public interface TestController
    {
        TestUnion ControllerProp { get; set; }
    }

    public interface TestUnion
    {
        [TsTypeUnions("number")]
        string TestUnionProp { get; set; }
    }

TestUnion.d.ts

export interface TestUnion {
    TestUnionProp: string;
}

Controller.cs

    [ExportTsInterface]
    public interface TestUnion
    {
        [TsTypeUnions("number")]
        string TestUnionProp { get; set; }
    }

TestUnion.d.ts

export interface TestUnion {
    TestUnionProp: string | number;
}