type R = ArrayPlus.Find<Array<string>, string> // string
type R = ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
type R = ArrayPlus.Find<Array<string | number>, number | string> // string | number
type R = ArrayPlus.Find<Array<number>, 1> // widen: 1 | undefined
type R = ArrayPlus.Find<Array<string | number>, number> // unionMiss: number | undefined
type R = ArrayPlus.Find<string[], number> // 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
Finds the type in array
A
that matchesCriteria
.