Skip to content

Proposal: Vertical bar before discriminated unions #13781

Closed
@ErikCupal

Description

@ErikCupal

If we want to align discriminated unions vertically, we can write them like this

type Action =
    Increment |
    Decrement |
    Reset

// or

type Action =
    Increment 
    | Decrement 
    | Reset

It doesn't look bad, but it can be quite annoying to check if the bars are at right places when you want to add new types at the beginning or at the end or when you want to reorginize them - basically the same issue as trailing commas.

What I would love to have is this:

type Action =
    | Increment 
    | Decrement 
    | Reset

It is easier to read and easier to maintain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions