type For<T,Tokens,Maybe>
Determines the result type for an array of tokens representing subpaths in type T
.
Definition
type For<T, Tokens, Maybe extends boolean =
Path.Internal.IsOptional
<T>> = Tokens extends [] ?
Path.Internal.MaybeValue
<T, Maybe> :
Path.Internal.IsOptional
<T> extends true ?
Path.Result.For
<Exclude<T, undefined
|
null>, Tokens, Maybe> : Tokens extends ['?.', infer Key, ...infer Rest] ?
Path.Result.For
<
Path.Result.Part
<T, Key, Maybe>, Rest, true> : Tokens extends ['.', infer Key, ...infer Rest] ?
Path.Result.For
<
Path.Result.Part
<T, Key, false>, Rest, Maybe> : Tokens extends [infer Key, ...infer Rest] ?
Path.Result.For
<
Path.Result.Part
<T, Key, false>, Rest, Maybe> : never;