Skip to content

Error when use spread arguments twice #32835

@KSXGitHub

Description

@KSXGitHub

TypeScript Version: 3.5.1

Search Terms:

Code

declare function fn (a: string, b: string, ...c: string[]): void
declare const foo: [string, string, ...string[]]
declare const bar: string[]
fn(...foo) // ok
fn(...foo, ...bar) // error
fn(...foo, ...foo) // error
fn(...bar, ...foo) // error

Expected behavior:

No errors

Actual behavior:

Expected at least 2 arguments, but got 1 or more

Playground Link: link

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions