Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Proposal: Vertical bar before discriminated unions #13781

Copy link
Copy link
@ErikCupal

Description

@ErikCupal
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.