Closed
Description
Bug Report
π Search Terms
array spread rest const
π Version & Regression Information
- This is only relevant for 5.0+ since it involves
const
modifier
β― Playground Link
Playground link with relevant code
π» Code
declare function foo<const T extends readonly unknown[]>(...args: T): T;
foo(...[1, 'bar']); // should be OK
foo(true, ...[1, 'bar']); // OK
declare function foo2<T extends readonly unknown[]>(...args: T): T;
foo2(...[1, 'bar']); // OK
foo2(true, ...[1, 'bar']); // OK
declare function foo3<T extends unknown[]>(...args: T): T;
foo3(...[1, 'bar']); // OK
foo3(true, ...[1, 'bar']); // OK
π Actual behavior
the first call is not allowed
π Expected behavior
the first call should be allowed since the rest of the calls are allowed