🔎 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