Skip to content

Union tuple type in rest argument can't accpect less argument.Β #48663

Description

@takanara1994

Bug Report

πŸ”Ž Search Terms

source has but target allows only

πŸ•— Version & Regression Information

  • This is a crash

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const func: (...args: [number, string] | [string, number]) => void = (item) => { }

πŸ™ Actual behavior

throw error

Type '(item: string | number) => void' is not assignable to type '(...args: [number, string] | [string, number]) => void'.
  Types of parameters 'item' and 'args' are incompatible.
    Type '[number, string] | [string, number]' is not assignable to type '[item: string | number]'.
      Type '[number, string]' is not assignable to type '[item: string | number]'.
        Source has 2 element(s) but target allows only 1.

πŸ™‚ Expected behavior

no error

Activity

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions