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

Suggestion: Allowing leading pipe in union type declarations #12071

Copy link
Copy link
@mariusschulz

Description

@mariusschulz
Issue body actions

Currently, because of the leading | symbol , the following code is invalid TypeScript:

type ReduxAction =
  | { type: "INCREMENT" }
  | { type: "DECREMENT" }
  | { type: "SET_VALUE", value: number };

I suggest we relax the syntax such that a single leading pipe symbol is allowed (but not required) in a union type declaration. Flow and F#, for example, both allow this syntax.

This change is backwards-compatible and gives developers a little more code formatting freedom.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    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.