Open
Description
🔎 Search Terms
tuple keyof never, tuple[never], array keyof never
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about this issue
Versions I tried:
- 5.2.2
- nightly (playground)
⏯ Playground Link
💻 Code
type A = {}[never] // ✅ never
type B = { a: string }[never] // ✅ never
type C = [][never] // ✅ never
type D = [string][never] // ❌ string
type E = string[][never] // ❌ string
type F = (string | number)[][never] // ❌ string | number
🙁 Actual behavior
After using a never
key on tuples/arrays you get back the entirety of the tuple/array elements type.
🙂 Expected behavior
After using a never
key on tuples/arrays you get back never
, as when dealing with objects.
Additional information about the issue
Not sure if this has historical reasons to behave like it does, but couldn't find any specific info about it.