type R = TuplePlus.Find<[true, 1, 'x', 3], string> // 'x'
type R = TuplePlus.Find<[true, 1, 'x', 3], number> // 1
type R = TuplePlus.Find<[string, number, 1], 1> // widen: 1 | undefined
type R = TuplePlus.Find<[true, number | string], string> // unionMiss: string | undefined
type R = TuplePlus.Find<[true, 1, 'x'], 2> // never
performs widen match.
Default to true
.
With widen match, a narrowed type will match its widen type.
e.g. matching 1
against number
yields 1 | undefined
The widen behavior can be customized by Options['$widen']
🦴 utilities 🔢 customizable
Find the first type in tuple
A
that matchesCriteria
.