Skip to content

Discriminated Unions pattern support #109

@doblak

Description

@doblak

I'd find it useful to be able to provide 'kind' string literal (see discriminated unions: https://www.typescriptlang.org/docs/handbook/advanced-types.html)

Example:

interface SquareDto {
    kind: "SQUARE";
    size: number;
}
interface CircleDto {
    kind: "CIRCLE";
    radius: number;
}

It would be possible to define public final String kind = "CIRCLE"; or maybe even public final ShapeKind kind = ShapeKind.CIRCLE; on dto.

Currently that gets emitted as kind: string; or kind: ShapeKind in typescript.

What do you think?

Thanks

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