Skip to content

Inconsistent order in unions between tuple values  #45144

Closed
@pushkine

Description

@pushkine

Bug Report

πŸ•— Version & Regression Information

ts stable & nightly

⏯ Playground Link

Playground Link

πŸ’» Code

// The last comes first

type T1 = [1][any];             // 1
type T2 = [1, 2][any];          // 2 | 1
type T3 = [1, 2, 3][any];       // 3 | 1 | 2
type T4 = [1, 2, 3, 4][any];    // 4 | 1 | 2 | 3
type T5 = [1, 2, 3, 4, 5][any]; // 5 | 1 | 2 | 3 | 4

πŸ™ Actual behavior

In this snippet, a Tuple's last member always comes first in unions between its values

πŸ™‚ Expected behavior

type T2 = [1, 2, 3][any]; // 1 | 2 | 3

Activity

MartinJohns

MartinJohns commented on Jul 22, 2021

@MartinJohns
Contributor

Essentially a duplicate of #17944.

typescript-bot

typescript-bot commented on Jul 24, 2021

@typescript-bot
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @MartinJohns@RyanCavanaugh@typescript-bot@pushkine

        Issue actions

          Inconsistent order in unions between tuple values Β· Issue #45144 Β· microsoft/TypeScript