π Search Terms
initial element of the tuple is a rest element
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.3.2#code/C4TwDgpgBAKgjFAvFA2gOgwZ2AJwJYB2A5igLoA0UBArgLYBGEOl9A9qwDYQCGBpAsACghAEwgBjDtxzRxrAtijScALlhwhQuQuBQAFjxFIlOHCgAMAwVBsB6W1AB6AfiE2o9qAFEAHpHHAECJq2PjEUAA+VHSMOEA
π» Code
type T1 = [...string[], number, boolean]
declare const arr: T1
const head = arr[0]
// Actual: string | number | boolean
// Expected: string | number
π Actual behavior
When the initial element of the tuple is a rest element, it is not possible to correctly infer the type of the initial element.
π Expected behavior
Infer the correct type.
Additional information about the issue
No response