Closed
Description
π Search Terms
spread tuple type narrowing
π Version & Regression Information
- This changed between versions 5.3.3 and 5.4.0-beta
- This changed in
5.4.0-dev.20240120
β― Playground Link
π» Code
declare function getT<T>(): T;
Promise.all([getT<string>(), ...getT<any>()])
.then((result) => {
// ^?
const head = result[0]; // 5.3: any, 5.4: string
// ^?
const tail = result.slice(1); // 5.3 any, 5.4: unknown[]
// ^?
tail satisfies string[]; // <-- new error in 5.4
});
Additional information about the issue
More of a 'change report' than a 'bug report', I don't think this was part of the 5.4 beta announcement.