Type Alias InsideValues<Tinput>
InsideValues<Tinput>: Tinput extends undefined ? undefined : Tinput extends null ? null : Tinput extends ((...args: any[]) => infer FnReturn) ? FnReturn : Writable<Tinput> extends Generator<infer Item> ? Item : Writable<Tinput> extends AsyncGenerator<infer Item> ? Item : Writable<Tinput> extends Promise<any> ? Awaited<Tinput> : Writable<Tinput> extends (infer Element)[] ? Element : Writable<Tinput> extends TypedArrayBigInt ? bigint : Writable<Tinput> extends TypedArrayNumber ? number : Writable<(...
)> extends ArrayBuffer ? number : (...
) extends (...
) ? (...
) : (...
)
InsideValues
Similar idea to TS's
ReturnType
, orGeneratorType
,Awaited
etc.InsideValues
gets the "Return value" or "Nested Values" or "elements" (collectively "items") value types, that are nested inside Tinput:Inside Values are different & similar for every type: it's the value they convey. For Function it's their
ReturnType
, forPromise
it isAwaited
(i.e Resolved value type), for Array its Array elements, and so on for TypedArray, Map, Set, Generator, Iterator, Iterable, Plain Objects, Instances, Classes and IArguments & even Singles!It can be used on every values, not just
IsNestingObject
orIsInspectableNested
, but also for mostTinputs
that hold some other value (types) somehow.So all types are allowed as Tinput: non-nested/non-Many types (i.e Single primitives like number, string, etc return the same type back, while their Boxed Primitives, return their primitive type.
In effect:
Note: we use Writable instead of Tinput, to avoid readonly issues