@thi.ng/api

  • Version 8.7.4
  • Published
  • 124 kB
  • No dependencies
  • Apache-2.0 license

Install

npm i @thi.ng/api
yarn add @thi.ng/api
pnpm add @thi.ng/api

Overview

Common, generic types, interfaces & mixins

Index

Variables

Functions

Interfaces

Enums

Type Aliases

Variables

variable BIGINT_ARRAY_CTORS

const BIGINT_ARRAY_CTORS: Record<BigType, BigIntArrayConstructor>;

    variable BIT_SHIFTS

    const BIT_SHIFTS: {
    i8: number;
    u8: number;
    u8c: number;
    i16: number;
    u16: number;
    i32: number;
    u32: number;
    i64: number;
    u64: number;
    f32: number;
    f64: number;
    };
    • Bit shift values to convert byte addresses into array indices for all Types and BigTypes.

    variable DEFAULT_EPS

    const DEFAULT_EPS: number;

      variable EVENT_ALL

      const EVENT_ALL: string;
      • Catch-all event ID

      variable EVENT_DISABLE

      const EVENT_DISABLE: string;

        variable EVENT_ENABLE

        const EVENT_ENABLE: string;

          variable FLOAT_ARRAY_CTORS

          const FLOAT_ARRAY_CTORS: Record<FloatType, FloatArrayConstructor>;

            variable GL2TYPE

            const GL2TYPE: Record<GLType, Type>;

            variable INT_ARRAY_CTORS

            const INT_ARRAY_CTORS: Record<IntType, IntArrayConstructor>;

              variable SIZEOF

              const SIZEOF: {
              u8: number;
              u8c: number;
              i8: number;
              u16: number;
              i16: number;
              u32: number;
              i32: number;
              i64: number;
              u64: number;
              f32: number;
              f64: number;
              };

              variable TYPE2GL

              const TYPE2GL: Record<Type, GLType>;
              • Potentially lossy conversion from Type to GLType enums.

                Not all enums are mappable:

                - F64 maps to undefined, since unsupported by WebGL - U8C maps to "u8"

              variable TYPEDARRAY_CTORS

              const TYPEDARRAY_CTORS: Record<Type, TypedArrayConstructor>;

                variable UINT_ARRAY_CTORS

                const UINT_ARRAY_CTORS: Record<UintType, UIntArrayConstructor>;

                  Functions

                  function asGLType

                  asGLType: (type: GLType | Type) => GLType;
                  • Returns suitable GLType enum of type.

                    Parameter type

                    Example 1

                    asGLType("f32") => GLType.F32
                    asGLType(GLType.F32) => GLType.F32

                  function asInt

                  asInt: (...args: number[]) => number[];
                  • Coerces given numeric args to integer values.

                  function asNativeType

                  asNativeType: (type: GLType | Type) => Type;
                  • Returns canonical Type value of type by first attempting to resolve it as GLType enum.

                    Parameter type

                    Example 1

                    asNativeType(GLType.F32) => "f32"
                    asNativeType("f32") => "f32"

                  function configurable

                  configurable: (state: boolean) => MethodDecorator;
                  • Property decorator factory. Sets configurable flag of PropertyDescriptor to given state.

                    Parameter state

                    true, if propoerty is configurable

                  function deprecated

                  deprecated: (
                  msg?: string,
                  log?: { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void }
                  ) => MethodDecorator;
                  • Method property decorator factory. Augments original method with deprecation message (via console), shown when method is invoked. Accepts optional message arg. Throws error if assigned property is not a function.

                    Parameter msg

                    deprecation message

                  function deref

                  deref: <T>(x: MaybeDeref<T>) => T;
                  • If x implements IDeref, returns its wrapped value, else returns x itself.

                    Parameter x

                  function IEnableMixin

                  IEnableMixin: (clazz: any) => any;
                  • Mixin class decorator, injects IEnable default implementation, incl. a _enabled property. If the target also implements the INotify interface, IEnable.enable and IEnable.disable will automatically emit the respective events.

                  function IGrid1DMixin

                  IGrid1DMixin: (clazz: any) => any;
                  • Default implementation for IGrid1D methods.

                  function IGrid2DMixin

                  IGrid2DMixin: (clazz: any) => any;
                  • Default implementation for IGrid2D methods.

                  function IGrid3DMixin

                  IGrid3DMixin: (clazz: any) => any;
                  • Default implementation for IGrid3D methods.

                  function IGrid4DMixin

                  IGrid4DMixin: (clazz: any) => any;
                  • Default implementation for IGrid4D methods.

                  function inotify_dispatch

                  inotify_dispatch: (listeners: any[][], e: Event) => boolean;

                    function INotifyMixin

                    INotifyMixin: (clazz: any) => any;
                    • Mixin class decorator, injects INotify default implementation, incl. a lazily instantiated _listeners property object, storing registered listeners.

                    function intTypeForBits

                    intTypeForBits: (x: number) => IntType;
                    • Returns suitable IntType for given bit size ([0,32] range)

                      Parameter x

                    function intTypeForSize

                    intTypeForSize: (x: number) => IntType;
                    • Returns the smallest possible *signed* int type enum for given x. E.g. if x >= -128 && x < 128, the function returns "i8".

                      Parameter x

                      value to classify

                    function isDeref

                    isDeref: (x: any) => x is IDeref<any>;
                    • Returns true iff x implements IDeref.

                      Parameter x

                    function iterable

                    iterable: (prop: PropertyKey) => (clazz: any) => any;

                      function IWatchMixin

                      IWatchMixin: (clazz: any) => any;

                        function mixin

                        mixin: (behaviour: any, sharedBehaviour?: any) => (clazz: any) => any;
                        • Class behavior mixin based on: - http://raganwald.com/2015/06/26/decorators-in-es7.html

                          Additionally only injects/overwrites properties in target, which are NOT marked with [@nomixin](https://docs.thi.ng/umbrella/api/functions/nomixin.html) (i.e. those which haven't set their configurable property descriptor flag to false)

                          Parameter behaviour

                          to mixin

                          Parameter sharedBehaviour

                          Returns

                          decorator function

                        function narrowFloat

                        narrowFloat: (t: FloatType) => string;
                        • Returns the next smaller FloatType for given type (or the same type if already the narrowest).

                          Parameter t

                        function narrowInt

                        narrowInt: (t: IntType | 'i64') => 'i32' | 'i8' | 'i16';
                        • Returns the next smaller IntType for given type (or the same type if already the narrowest).

                          Parameter t

                        function narrowType

                        narrowType: (t: Type | BigType) => string;
                        • Returns the next smaller type (i.e. IntType, UintType or FloatType) for given type (or the same type if already the smallest).

                          Parameter t

                        function narrowUint

                        narrowUint: (t: UintType | 'u64') => 'u8' | 'u16' | 'u32';
                        • Returns the next smaller UintType for given type (or the same type if already the narrowest).

                          Parameter t

                          Remarks

                          If type is u8c, returns u8.

                        function NO_OP

                        NO_OP: () => void;
                        • No-effect placeholder function.

                        function nomixin

                        nomixin: (_: any, __: string, descriptor: PropertyDescriptor) => void;
                        • Method property decorator. Sets configurable flag of PropertyDescriptor to false (same as @configurable(false)). Intended to be used in combination with mixin decorators to enable partial implementations of mixed-in behaviors in target class and avoid them being overidden by mixed-in behaviour.

                        function sealed

                        sealed: (constructor: Function) => void;
                        • Class decorator. Seals both constructor and prototype.

                          Parameter constructor

                          class ctor to seal

                        function sizeOf

                        sizeOf: (type: Type | BigType | GLType) => number;
                        • Returns byte size for given Type ID or GLType enum.

                          Parameter type

                        function typedArray

                        typedArray: {
                        <T extends Type | GLType>(type: T, length: number): TypedArrayTypeMap[T];
                        <T extends Type | GLType>(
                        type: T,
                        src: ArrayLike<number> | ArrayBufferLike
                        ): TypedArrayTypeMap[T];
                        <T extends Type | GLType>(
                        type: T,
                        buf: ArrayBufferLike,
                        byteOffset: number,
                        length?: number
                        ): TypedArrayTypeMap[T];
                        <T extends BigType>(type: T, length: number): BigTypedArrayTypeMap[T];
                        <T extends BigType>(
                        type: T,
                        src: ArrayBufferLike | ArrayLike<bigint>
                        ): BigTypedArrayTypeMap[T];
                        <T extends BigType>(
                        type: T,
                        buf: ArrayBufferLike,
                        byteOffset: number,
                        length?: number
                        ): BigTypedArrayTypeMap[T];
                        };
                        • Constructs new typed array of given Type, GLType or BigType. Supports all arities of standard typed array ctors.

                          Parameter type

                          array type enum

                        function typedArrayType

                        typedArrayType: (x: NumericArray) => Type;
                        • Takes an NumericArray and returns its corresponding Type ID. Standard JS arrays will default to f64.

                          Parameter x

                        function uintTypeForBits

                        uintTypeForBits: (x: number) => UintType;
                        • Returns suitable UintType for given bit size ([0,32] range)

                          Parameter x

                        function uintTypeForSize

                        uintTypeForSize: (x: number) => UintType;
                        • Returns the smallest possible *unsigned* int type enum for given x. E.g. if x <= 256, the function returns "u8".

                          Parameter x

                          value to classify

                        function widenFloat

                        widenFloat: (t: FloatType) => string;
                        • Returns the next larger FloatType for given type (or the same type if already the widest).

                          Parameter t

                        function widenInt

                        widenInt: (t: IntType) => 'i32' | 'i64' | 'i16';
                        • Returns the next larger IntType for given type (or the same type if already the widest).

                          Parameter t

                        function widenType

                        widenType: (t: Type | BigType) => string;
                        • Returns the next larger type (i.e. IntType, UintType or FloatType) for given type (or the same type if already the widest).

                          Parameter t

                        function widenUint

                        widenUint: (t: UintType) => 'u16' | 'u32' | 'u64';
                        • Returns the next larger UintType for given type (or the same type if already the widest).

                          Parameter t

                        Interfaces

                        interface BigTypedArrayTypeMap

                        interface BigTypedArrayTypeMap extends Record<BigType, BigTypedArray> {}

                          property i64

                          i64: BigInt64Array;

                            property u64

                            u64: BigUint64Array;

                              interface Event

                              interface Event extends IID<PropertyKey> {}

                                property canceled

                                canceled?: boolean;

                                  property target

                                  target?: any;

                                    property value

                                    value?: any;

                                      interface IAssoc

                                      interface IAssoc<K, V, T> {}
                                      • Parameter K

                                        key type

                                        Parameter V

                                        value type

                                        Parameter T

                                        return type

                                      method assoc

                                      assoc: (key: K, val: V) => T;

                                        method update

                                        update: (key: K, f: Fn<V, V>) => T;

                                          interface IAssocIn

                                          interface IAssocIn<K, V, T> {}
                                          • Parameter K

                                            key type

                                            Parameter V

                                            value type

                                            Parameter T

                                            return type

                                          method assocIn

                                          assocIn: (key: K[], val: V) => T;

                                            method updateIn

                                            updateIn: (key: K[], f: Fn<V, V>) => T;

                                              interface IBind

                                              interface IBind<T> {}
                                              • Generic resource binding methods.

                                              method bind

                                              bind: (opt: T) => boolean;
                                              • Returns

                                                true, if successful

                                              method unbind

                                              unbind: (opt: T) => boolean;
                                              • Returns

                                                true, if successful

                                              interface IBuffered

                                              interface IBuffered<T> {}
                                              • Generic interface for types with binary backing buffers.

                                              property buffer

                                              buffer: T;
                                              • An implementation's publicly accessible backing array / ArrayBuffer (usually a typed array instance).

                                              method bytes

                                              bytes: () => Uint8Array;
                                              • Returns an Uint8Array view of backing array.

                                              interface IClear

                                              interface IClear {}
                                              • Interface for mutable types supporting internal cleanup (e.g. removing all values in a container etc.).

                                                Remarks

                                                Also see IEmpty and IRelease for related operations.

                                              method clear

                                              clear: () => void;

                                                interface ICompare

                                                interface ICompare<T> {}
                                                • Generic interface to compare value types.

                                                method compare

                                                compare: (x: T) => number;
                                                • Compares this value with given value x. MUST follow same contract as Comparator.

                                                  Parameter x

                                                  compare value

                                                  Remarks

                                                  MUST return 0 if the type also implements IEquiv and equiv returns true for same x.

                                                  Also see IHash.

                                                interface IContains

                                                interface IContains<T> {}
                                                • Generic interface for collection types to check if a given value is part of the collection.

                                                method contains

                                                contains: (x: T) => boolean;
                                                • Returns true if x is part of collection.

                                                  Parameter x

                                                  value to check for

                                                interface ICopy

                                                interface ICopy<T> {}
                                                • Generic interface for clonable types.

                                                method copy

                                                copy: () => T;
                                                • Returns a copy of this instance. Shallow or deep copies are implementation specific.

                                                interface IDeref

                                                interface IDeref<T> {}
                                                • Generic interface for reference types (value wrappers).

                                                method deref

                                                deref: () => T;
                                                • Returns wrapped value.

                                                interface IDissoc

                                                interface IDissoc<K, V, T> extends IAssoc<K, V, T> {}
                                                • Extension of IAssoc for types supporting key removals.

                                                  Parameter K

                                                  key type

                                                  Parameter V

                                                  value type

                                                  Parameter T

                                                  return type

                                                method dissoc

                                                dissoc: (key: K) => T;

                                                  interface IDissocIn

                                                  interface IDissocIn<K, V, T> extends IAssocIn<K, V, T> {}
                                                  • Extension of IAssocIn for types supporting key removals.

                                                    Parameter K

                                                    key type

                                                    Parameter V

                                                    value type

                                                    Parameter T

                                                    return type

                                                  method dissocIn

                                                  dissocIn: (key: K[]) => T;

                                                    interface IEmpty

                                                    interface IEmpty<T> {}

                                                      method empty

                                                      empty: () => T;
                                                      • Returns an empty/blank instance of same type (with possibly same config, if any).

                                                      interface IEnable

                                                      interface IEnable<T> {}
                                                      • Interface to provide enabled/disabled functionality. Also see @IEnable decorator mixin

                                                        Parameter T

                                                        type for enable/disable option arg

                                                      method disable

                                                      disable: (opts?: T) => any;
                                                      • Disables this entity.

                                                        Parameter opts

                                                        optional implementation specific arg

                                                      method enable

                                                      enable: (opts?: T) => any;
                                                      • Enables this entity.

                                                        Parameter opts

                                                        optional implementation specific arg

                                                      method isEnabled

                                                      isEnabled: () => boolean;

                                                        method toggle

                                                        toggle: () => boolean;

                                                          interface IEqualsDelta

                                                          interface IEqualsDelta<T> {}
                                                          • Parameter T

                                                            value type

                                                          method eqDelta

                                                          eqDelta: (o: T, eps?: number) => boolean;
                                                          • Returns true if this value equals o with optional allowance for given tolerance eps.

                                                            Parameter o

                                                            2nd value to test

                                                            Parameter eps

                                                            tolerance (usually defaults to DEFAULT_EPS)

                                                          interface IEquiv

                                                          interface IEquiv {}

                                                            method equiv

                                                            equiv: (o: any) => boolean;
                                                            • Returns true if this *value* is equivalent to o. Also see ICompare.compare and IHash.hash.

                                                              Parameter o

                                                              value to check for equivalence

                                                            interface IGet

                                                            interface IGet<K, V> {}
                                                            • Parameter K

                                                              key type

                                                              Parameter V

                                                              value type

                                                            method get

                                                            get: (key: K, notfound?: V) => V | undefined;

                                                              interface IGetIn

                                                              interface IGetIn<K, V> {}
                                                              • Parameter K

                                                                key type

                                                                Parameter V

                                                                value type

                                                              method getIn

                                                              getIn: (key: K[], notfound?: V) => V | undefined;

                                                                interface IGrid1D

                                                                interface IGrid1D<BUF extends any[] | TypedArray = any[], T = any>
                                                                extends INDBase<BUF> {}
                                                                • Gridlike container for 1D accessible data.

                                                                  Remarks

                                                                  See IGrid1DMixin for mixin implementation.

                                                                property dim

                                                                readonly dim: 1;

                                                                  method getAt

                                                                  getAt: (d0: number) => T;
                                                                  • Returns value at given position. If outside the grid's defined region, returns a suitable zero value.

                                                                    Parameter d0

                                                                  method getAtUnsafe

                                                                  getAtUnsafe: (d0: number) => T;
                                                                  • Non-boundschecked version of IGrid1D.getAt. Assumes given position is valid.

                                                                    Parameter d0

                                                                  method includes

                                                                  includes: (d0: number) => boolean;
                                                                  • Returns true if given position is valid (i.e. within grid bounds).

                                                                    Parameter d0

                                                                  method indexAt

                                                                  indexAt: (d0: number) => number;
                                                                  • Returns index for given position. Returns negative value if outside the grid's defined region.

                                                                    Parameter d0

                                                                  method indexAtUnsafe

                                                                  indexAtUnsafe: (d0: number) => number;
                                                                  • Non-boundschecked version of IGrid1D.indexAt. Assumes given position is valid.

                                                                    Parameter d0

                                                                  method setAt

                                                                  setAt: (d0: number, value: T) => boolean;
                                                                  • Writes value at given position. Has no effect if outside of the defined region. Returns true, if succeeded.

                                                                    Parameter d0

                                                                    Parameter value

                                                                  method setAtUnsafe

                                                                  setAtUnsafe: (d0: number, value: T) => boolean;
                                                                  • Non-boundschecked version of IGrid1D.setAt. Assumes given position is valid. Returns true, if succeeded.

                                                                    Parameter d0

                                                                    Parameter value

                                                                  interface IGrid2D

                                                                  interface IGrid2D<BUF extends any[] | TypedArray = any[], T = any>
                                                                  extends INDBase<BUF> {}
                                                                  • Gridlike container for 2D accessible data.

                                                                    Remarks

                                                                    See IGrid2DMixin for mixin implementation.

                                                                  property dim

                                                                  readonly dim: 2;

                                                                    method getAt

                                                                    getAt: (d0: number, d1: number) => T;
                                                                    • Returns value at given position (given in same order as IGrid2D.size and IGrid2D.stride). If outside the grid's defined region, returns a suitable zero value.

                                                                      Parameter d0

                                                                      Parameter d1

                                                                    method getAtUnsafe

                                                                    getAtUnsafe: (d0: number, d1: number) => T;
                                                                    • Non-boundschecked version of IGrid2D.getAt. Assumes given position is valid.

                                                                      Parameter d0

                                                                      Parameter d1

                                                                    method includes

                                                                    includes: (d0: number, d1: number) => boolean;
                                                                    • Returns true if given position is valid (i.e. within grid bounds).

                                                                      Parameter d0

                                                                      Parameter d1

                                                                    method indexAt

                                                                    indexAt: (d0: number, d1: number) => number;
                                                                    • Returns index for given position (stated in same order as IGrid2D.size and IGrid2D.stride). Returns negative value if outside the grid's defined region.

                                                                      Parameter d0

                                                                      Parameter d1

                                                                    method indexAtUnsafe

                                                                    indexAtUnsafe: (d0: number, d1: number) => number;
                                                                    • Non-boundschecked version of IGrid2D.indexAt. Assumes given position is valid.

                                                                      Parameter d0

                                                                      Parameter d1

                                                                    method setAt

                                                                    setAt: (d0: number, d1: number, value: T) => boolean;
                                                                    • Writes value at given position (given in same order as IGrid2D.size and IGrid2D.stride). Has no effect if outside of the defined region. Returns true, if succeeded.

                                                                      Parameter d0

                                                                      Parameter d1

                                                                      Parameter value

                                                                    method setAtUnsafe

                                                                    setAtUnsafe: (d0: number, d1: number, value: T) => boolean;
                                                                    • Non-boundschecked version of IGrid2D.setAt. Assumes given position is valid. Returns true, if succeeded.

                                                                      Parameter d0

                                                                      Parameter d1

                                                                      Parameter value

                                                                    interface IGrid3D

                                                                    interface IGrid3D<BUF extends any[] | TypedArray = any[], T = any>
                                                                    extends INDBase<BUF> {}
                                                                    • Gridlike container for 3D accessible data.

                                                                      Remarks

                                                                      See IGrid3DMixin for mixin implementation.

                                                                    property dim

                                                                    readonly dim: 3;

                                                                      method getAt

                                                                      getAt: (d0: number, d1: number, d2: number) => T;
                                                                      • Returns value at given position (given in same order as IGrid3D.size and IGrid3D.stride). If outside the grid's defined region, returns a suitable zero value.

                                                                        Parameter d0

                                                                        Parameter d1

                                                                        Parameter d2

                                                                      method getAtUnsafe

                                                                      getAtUnsafe: (d0: number, d1: number, d2: number) => T;
                                                                      • Non-boundschecked version of IGrid3D.getAt. Assumes given position is valid.

                                                                        Parameter d0

                                                                        Parameter d1

                                                                        Parameter d2

                                                                      method includes

                                                                      includes: (d0: number, d1: number, d2: number) => boolean;
                                                                      • Returns true if given position is valid (i.e. within grid bounds).

                                                                        Parameter d0

                                                                        Parameter d1

                                                                        Parameter d2

                                                                      method indexAt

                                                                      indexAt: (d0: number, d1: number, d2: number) => number;
                                                                      • Returns index for given position (stated in same order as IGrid3D.size and IGrid3D.stride). Returns negative value if outside the grid's defined region.

                                                                        Parameter d0

                                                                        Parameter d1

                                                                        Parameter d2

                                                                      method indexAtUnsafe

                                                                      indexAtUnsafe: (d0: number, d1: number, d2: number) => number;
                                                                      • Non-boundschecked version of IGrid3D.indexAt. Assumes given position is valid.

                                                                        Parameter d0

                                                                        Parameter d1

                                                                        Parameter d2

                                                                      method setAt

                                                                      setAt: (d0: number, d1: number, d2: number, value: T) => boolean;
                                                                      • Writes value at given position (given in same order as IGrid3D.size and IGrid3D.stride). Has no effect if outside of the defined region. Returns true, if succeeded.

                                                                        Parameter d0

                                                                        Parameter d1

                                                                        Parameter d2

                                                                        Parameter value

                                                                      method setAtUnsafe

                                                                      setAtUnsafe: (d0: number, d1: number, d2: number, value: T) => boolean;
                                                                      • Non-boundschecked version of IGrid3D.setAt. Assumes given position is valid. Returns true, if succeeded.

                                                                        Parameter d0

                                                                        Parameter d1

                                                                        Parameter d2

                                                                        Parameter value

                                                                      interface IGrid4D

                                                                      interface IGrid4D<BUF extends any[] | TypedArray = any[], T = any>
                                                                      extends INDBase<BUF> {}
                                                                      • Gridlike container for 4D accessible data.

                                                                        Remarks

                                                                        See IGrid4DMixin for mixin implementation.

                                                                      property dim

                                                                      readonly dim: 4;

                                                                        method getAt

                                                                        getAt: (d0: number, d1: number, d2: number, d3: number) => T;
                                                                        • Returns value at given position (given in same order as IGrid4D.size and IGrid4D.stride). If outside the grid's defined region, returns a suitable zero value.

                                                                          Parameter d0

                                                                          Parameter d1

                                                                          Parameter d2

                                                                          Parameter d3

                                                                        method getAtUnsafe

                                                                        getAtUnsafe: (d0: number, d1: number, d2: number, d3: number) => T;
                                                                        • Non-boundschecked version of IGrid4D.getAt. Assumes given position is valid.

                                                                          Parameter d0

                                                                          Parameter d1

                                                                          Parameter d2

                                                                          Parameter d3

                                                                        method includes

                                                                        includes: (d0: number, d1: number, d2: number, d3: number) => boolean;
                                                                        • Returns true if given position is valid (i.e. within grid bounds).

                                                                          Parameter d0

                                                                          Parameter d1

                                                                          Parameter d2

                                                                          Parameter d3

                                                                        method indexAt

                                                                        indexAt: (d0: number, d1: number, d2: number, d3: number) => number;
                                                                        • Returns index for given position (stated in same order as IGrid4D.size and IGrid4D.stride). Returns negative value if outside the grid's defined region.

                                                                          Parameter d0

                                                                          Parameter d1

                                                                          Parameter d2

                                                                          Parameter d3

                                                                        method indexAtUnsafe

                                                                        indexAtUnsafe: (d0: number, d1: number, d2: number, d3: number) => number;
                                                                        • Non-boundschecked version of IGrid4D.indexAt. Assumes given position is valid.

                                                                          Parameter d0

                                                                          Parameter d1

                                                                          Parameter d2

                                                                          Parameter d3

                                                                        method setAt

                                                                        setAt: (d0: number, d1: number, d2: number, d3: number, value: T) => boolean;
                                                                        • Writes value at given position (given in same order as IGrid4D.size and IGrid4D.stride). Has no effect if outside of the defined region. Returns true, if succeeded.

                                                                          Parameter d0

                                                                          Parameter d1

                                                                          Parameter d2

                                                                          Parameter d3

                                                                          Parameter value

                                                                        method setAtUnsafe

                                                                        setAtUnsafe: (
                                                                        d0: number,
                                                                        d1: number,
                                                                        d2: number,
                                                                        d3: number,
                                                                        value: T
                                                                        ) => boolean;
                                                                        • Non-boundschecked version of IGrid4D.setAt. Assumes given position is valid. Returns true, if succeeded.

                                                                          Parameter d0

                                                                          Parameter d1

                                                                          Parameter d2

                                                                          Parameter d3

                                                                          Parameter value

                                                                        interface IGridND

                                                                        interface IGridND<BUF extends any[] | TypedArray = any[], T = any>
                                                                        extends INDBase<BUF> {}
                                                                        • Semi-typechecked interface for cases accepting 1D-4D grids, i.e. IGrid1D - IGrid4D.

                                                                        method getAt

                                                                        getAt: (
                                                                        ...pos:
                                                                        | [number]
                                                                        | [number, number]
                                                                        | [number, number, number]
                                                                        | [number, number, number, number]
                                                                        ) => T;
                                                                        • Returns value at given position. If outside the grid's defined region, returns a suitable zero value.

                                                                          Parameter pos

                                                                        method getAtUnsafe

                                                                        getAtUnsafe: (
                                                                        ...pos:
                                                                        | [number]
                                                                        | [number, number]
                                                                        | [number, number, number]
                                                                        | [number, number, number, number]
                                                                        ) => T;
                                                                        • Non-boundschecked version of IGridND.getAt. Assumes given position is valid.

                                                                          Parameter pos

                                                                        method includes

                                                                        includes: (
                                                                        ...pos:
                                                                        | [number]
                                                                        | [number, number]
                                                                        | [number, number, number]
                                                                        | [number, number, number, number]
                                                                        ) => boolean;
                                                                        • Returns true if given position is valid (i.e. within grid bounds).

                                                                          Parameter pos

                                                                        method indexAt

                                                                        indexAt: (
                                                                        ...pos:
                                                                        | [number]
                                                                        | [number, number]
                                                                        | [number, number, number]
                                                                        | [number, number, number, number]
                                                                        ) => number;
                                                                        • Returns index for given position. Returns negative value if outside the grid's defined region.

                                                                          Parameter pos

                                                                        method indexAtUnsafe

                                                                        indexAtUnsafe: (
                                                                        ...pos:
                                                                        | [number]
                                                                        | [number, number]
                                                                        | [number, number, number]
                                                                        | [number, number, number, number]
                                                                        ) => number;
                                                                        • Non-boundschecked version of IGridND.indexAt. Assumes given position is valid.

                                                                          Parameter pos

                                                                        method setAt

                                                                        setAt: (
                                                                        ...args:
                                                                        | [number, T]
                                                                        | [number, number, T]
                                                                        | [number, number, number, T]
                                                                        | [number, number, number, number, T]
                                                                        ) => boolean;
                                                                        • Writes value at given position. Has no effect if outside of the defined region. Returns true, if succeeded.

                                                                          Parameter args

                                                                        method setAtUnsafe

                                                                        setAtUnsafe: (
                                                                        ...args:
                                                                        | [number, T]
                                                                        | [number, number, T]
                                                                        | [number, number, number, T]
                                                                        | [number, number, number, number, T]
                                                                        ) => boolean;
                                                                        • Non-boundschecked version of IGridND.setAt. Assumes given position is valid. Returns true, if succeeded.

                                                                          Parameter args

                                                                        interface IHash

                                                                        interface IHash<T> {}
                                                                        • Interface for hashable types.

                                                                        method hash

                                                                        hash: () => T;
                                                                        • Returns a value's hash code. The contract of this function is: If IEquiv.equiv returns true for two values, their hash codes MUST also be equal.

                                                                        interface IID

                                                                        interface IID<T> {}
                                                                        • id property declaration.

                                                                        property id

                                                                        readonly id: T;

                                                                          interface IIndexed

                                                                          interface IIndexed<T> {}
                                                                          • Interface for collection types which can be accessed via numeric index.

                                                                          method nth

                                                                          nth: (i: number, notfound: T) => T;

                                                                            interface IInto

                                                                            interface IInto<V, T> {}
                                                                            • Interface for collection types supporting addition of multiple values.

                                                                            method into

                                                                            into: (coll: Iterable<V>) => T;

                                                                              interface ILength

                                                                              interface ILength {}
                                                                              • length property declaration for collections to obtain their element count.

                                                                              property length

                                                                              readonly length: number;

                                                                                interface IMeta

                                                                                interface IMeta<T> {}
                                                                                • Generic interface for types supporting metadata. Implementations MUST exclude metadata from any comparisons, equality checks & hashing.

                                                                                method meta

                                                                                meta: () => any;

                                                                                  method withMeta

                                                                                  withMeta: (meta: any) => T;
                                                                                  • Returns a copy of the original value with given metadata attached.

                                                                                    Parameter meta

                                                                                    meta data

                                                                                  interface INDBase

                                                                                  interface INDBase<BUF extends any[] | TypedArray = any[]> {}

                                                                                    property data

                                                                                    data: BUF;

                                                                                      property dim

                                                                                      readonly dim: number;

                                                                                        property offset

                                                                                        offset: number;

                                                                                          property size

                                                                                          size: NumericArray;

                                                                                            property stride

                                                                                            stride: NumericArray;

                                                                                              method order

                                                                                              order: () => number[];

                                                                                                interface INotify

                                                                                                interface INotify {}
                                                                                                • Interface to provide event emitter functionality. Also see INotifyMixin decorator mixin.

                                                                                                method addListener

                                                                                                addListener: (id: string, fn: Listener, scope?: any) => boolean;

                                                                                                  method notify

                                                                                                  notify: (event: Event) => boolean;
                                                                                                  • Broadcasts all registered listeners for given event type (in order registration) and returns true if any of them have been successfully notified.

                                                                                                    Parameter event

                                                                                                    Remarks

                                                                                                    If a listener canceled the event (by setting Event.canceled), the function will stop notifying other listeners and return false. If no listeners are registered for the event, the function will also return false.

                                                                                                  method removeListener

                                                                                                  removeListener: (id: string, fn: Listener, scope?: any) => boolean;

                                                                                                    interface IObjectOf

                                                                                                    interface IObjectOf<T> {}
                                                                                                    • Generic plain object with all key values of given type.

                                                                                                    index signature

                                                                                                    [id: string]: T;

                                                                                                      interface IRelease

                                                                                                      interface IRelease {}
                                                                                                      • Interface for types supported the release of internal resources.

                                                                                                      method release

                                                                                                      release: (opt?: any) => boolean;

                                                                                                        interface IReset

                                                                                                        interface IReset {}
                                                                                                        • Interface for types supporting some form of internal state reset.

                                                                                                        method reset

                                                                                                        reset: () => this;

                                                                                                          interface ISeq

                                                                                                          interface ISeq<T> {}
                                                                                                          • Lisp-like sequence abstraction for arbitrary types using first & next operations only.

                                                                                                            Remarks

                                                                                                            Unlike ES6 iterators this approach does not conflate both operations and first() can be called any number of times to obtain the current value (if any) from the sequence.

                                                                                                          method first

                                                                                                          first: () => T | undefined;
                                                                                                          • Returns the sequence's first value or undefined if there're no further values.

                                                                                                            Remarks

                                                                                                            If the sequence is guaranteed to not include undefined values, a simple check for seq.first() === undefined is sufficient to determine the end. If the sequence DOES contain undefined values, the check should use seq.next().

                                                                                                          method next

                                                                                                          next: () => ISeq<T> | undefined;
                                                                                                          • Returns a new sequence of the remaining elements or undefined if there're no further values.

                                                                                                            Remarks

                                                                                                            In general, implementations of this interface MUST always return a new sequence instance and not mutate some internal cursor. I.e. seq.next() !== seq

                                                                                                          interface ISeqable

                                                                                                          interface ISeqable<T> {}
                                                                                                          • Interface for data types providing an ISeq abstraction.

                                                                                                          method seq

                                                                                                          seq: () => ISeq<T> | undefined;
                                                                                                          • Returns an ISeq of the type's data or undefined if there're no values available. See ISeq.next

                                                                                                          interface ISet

                                                                                                          interface ISet<V, T> extends IInto<V, T> {}
                                                                                                          • Generic interface for set collection types.

                                                                                                            Parameter V

                                                                                                            value type

                                                                                                            Parameter T

                                                                                                            return type

                                                                                                          method conj

                                                                                                          conj: (x: V) => T;
                                                                                                          • Conjoins/adds value x to set.

                                                                                                            Parameter x

                                                                                                            value to add

                                                                                                          method disj

                                                                                                          disj: (x: V) => T;
                                                                                                          • Disjoins/removes value x from set.

                                                                                                            Parameter x

                                                                                                            value to remove

                                                                                                          interface IStack

                                                                                                          interface IStack<V, P, S> {}
                                                                                                          • Generic interface for collections implementing stack functionality.

                                                                                                            Parameter V

                                                                                                            value type

                                                                                                            Parameter P

                                                                                                            return type for pop()

                                                                                                            Parameter S

                                                                                                            return type for push()

                                                                                                          method peek

                                                                                                          peek: () => V | undefined;
                                                                                                          • Returns top-of-stack item.

                                                                                                          method pop

                                                                                                          pop: () => P | undefined;
                                                                                                          • Removes top-of-stack item and returns type P.

                                                                                                          method push

                                                                                                          push: (x: V) => S;

                                                                                                            interface IToHiccup

                                                                                                            interface IToHiccup {}

                                                                                                              method toHiccup

                                                                                                              toHiccup: (ctx?: any, attribs?: any, ...xs: any[]) => any;
                                                                                                              • Returns a [thi.ng/hiccup](https://thi.ng/hiccup) compatible representation. The optional ctx arg is an arbitrary user context object passed to all hiccup components during serialization (or during DOM creation / update if used with [thi.ng/hdom](https://thi.ng/hdom)).

                                                                                                                Parameter ctx

                                                                                                                user context object

                                                                                                                Parameter attribs

                                                                                                                user attribs

                                                                                                                Parameter xs

                                                                                                                additional args

                                                                                                              interface IWatch

                                                                                                              interface IWatch<T> {}
                                                                                                              • Interface for types offering observers of internal value changes. Also see @IWatch decorator mixin.

                                                                                                              method addWatch

                                                                                                              addWatch: (id: string, fn: Watch<T>) => boolean;

                                                                                                                method notifyWatches

                                                                                                                notifyWatches: (oldState: T, newState: T) => void;

                                                                                                                  method removeWatch

                                                                                                                  removeWatch: (id: string) => boolean;

                                                                                                                    interface RangeValueMap

                                                                                                                    interface RangeValueMap {}
                                                                                                                    • Type LUT of allowed range values [0..n) for given range size n.

                                                                                                                      Example 1

                                                                                                                      RangeValueMap[4] -> 0 | 1 | 2 | 3

                                                                                                                    property 1

                                                                                                                    1: 0;

                                                                                                                      property 10

                                                                                                                      10: Range0_7 | 8 | 9;

                                                                                                                        property 11

                                                                                                                        11: Range0_7 | 8 | 9 | 10;

                                                                                                                          property 12

                                                                                                                          12: Range0_7 | 8 | 9 | 10 | 11;

                                                                                                                            property 13

                                                                                                                            13: Range0_7 | 8 | 9 | 10 | 11 | 12;

                                                                                                                              property 14

                                                                                                                              14: Range0_7 | 8 | 9 | 10 | 11 | 12 | 13;

                                                                                                                                property 15

                                                                                                                                15: Range0_7 | 8 | 9 | 10 | 11 | 12 | 13 | 14;

                                                                                                                                  property 16

                                                                                                                                  16: Range0_15;

                                                                                                                                    property 17

                                                                                                                                    17: Range0_15 | 16;

                                                                                                                                      property 18

                                                                                                                                      18: Range0_15 | 16 | 17;

                                                                                                                                        property 19

                                                                                                                                        19: Range0_15 | 16 | 17 | 18;

                                                                                                                                          property 2

                                                                                                                                          2: Range0_1;

                                                                                                                                            property 20

                                                                                                                                            20: Range0_15 | 16 | 17 | 18 | 19;

                                                                                                                                              property 21

                                                                                                                                              21: Range0_15 | 16 | 17 | 18 | 19 | 20;

                                                                                                                                                property 22

                                                                                                                                                22: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21;

                                                                                                                                                  property 23

                                                                                                                                                  23: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21 | 22;

                                                                                                                                                    property 24

                                                                                                                                                    24: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;

                                                                                                                                                      property 25

                                                                                                                                                      25: Exclude<Range0_31, 25 | 26 | 27 | 28 | 29 | 30 | 31>;

                                                                                                                                                        property 26

                                                                                                                                                        26: Exclude<Range0_31, 26 | 27 | 28 | 29 | 30 | 31>;

                                                                                                                                                          property 27

                                                                                                                                                          27: Exclude<Range0_31, 27 | 28 | 29 | 30 | 31>;

                                                                                                                                                            property 28

                                                                                                                                                            28: Exclude<Range0_31, 28 | 29 | 30 | 31>;

                                                                                                                                                              property 29

                                                                                                                                                              29: Exclude<Range0_31, 29 | 30 | 31>;

                                                                                                                                                                property 3

                                                                                                                                                                3: Range0_1 | 2;

                                                                                                                                                                  property 30

                                                                                                                                                                  30: Exclude<Range0_31, 30 | 31>;

                                                                                                                                                                    property 31

                                                                                                                                                                    31: Exclude<Range0_31, 31>;

                                                                                                                                                                      property 32

                                                                                                                                                                      32: Range0_31;

                                                                                                                                                                        property 33

                                                                                                                                                                        33: Range0_31 | 32;

                                                                                                                                                                          property 34

                                                                                                                                                                          34: Range0_31 | 32 | 33;

                                                                                                                                                                            property 35

                                                                                                                                                                            35: Range0_31 | 32 | 33 | 34;

                                                                                                                                                                              property 36

                                                                                                                                                                              36: Range0_31 | 32 | 33 | 34 | 35;

                                                                                                                                                                                property 37

                                                                                                                                                                                37: Range0_31 | 32 | 33 | 34 | 35 | 36;

                                                                                                                                                                                  property 38

                                                                                                                                                                                  38: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37;

                                                                                                                                                                                    property 39

                                                                                                                                                                                    39: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37 | 38;

                                                                                                                                                                                      property 4

                                                                                                                                                                                      4: Range0_3;

                                                                                                                                                                                        property 40

                                                                                                                                                                                        40: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39;

                                                                                                                                                                                          property 41

                                                                                                                                                                                          41: Exclude<Range0_47, 41 | 42 | 43 | 44 | 45 | 46 | 47>;

                                                                                                                                                                                            property 42

                                                                                                                                                                                            42: Exclude<Range0_47, 42 | 43 | 44 | 45 | 46 | 47>;

                                                                                                                                                                                              property 43

                                                                                                                                                                                              43: Exclude<Range0_47, 43 | 44 | 45 | 46 | 47>;

                                                                                                                                                                                                property 44

                                                                                                                                                                                                44: Exclude<Range0_47, 44 | 45 | 46 | 47>;

                                                                                                                                                                                                  property 45

                                                                                                                                                                                                  45: Exclude<Range0_47, 45 | 46 | 47>;

                                                                                                                                                                                                    property 46

                                                                                                                                                                                                    46: Exclude<Range0_47, 46 | 47>;

                                                                                                                                                                                                      property 47

                                                                                                                                                                                                      47: Exclude<Range0_47, 47>;

                                                                                                                                                                                                        property 48

                                                                                                                                                                                                        48: Range0_47;

                                                                                                                                                                                                          property 49

                                                                                                                                                                                                          49: Range0_47 | 48;

                                                                                                                                                                                                            property 5

                                                                                                                                                                                                            5: Range0_3 | 4;

                                                                                                                                                                                                              property 50

                                                                                                                                                                                                              50: Range0_47 | 48 | 49;

                                                                                                                                                                                                                property 51

                                                                                                                                                                                                                51: Range0_47 | 48 | 49 | 50;

                                                                                                                                                                                                                  property 52

                                                                                                                                                                                                                  52: Range0_47 | 48 | 49 | 50 | 51;

                                                                                                                                                                                                                    property 53

                                                                                                                                                                                                                    53: Range0_47 | 48 | 49 | 50 | 51 | 52;

                                                                                                                                                                                                                      property 54

                                                                                                                                                                                                                      54: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53;

                                                                                                                                                                                                                        property 55

                                                                                                                                                                                                                        55: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53 | 54;

                                                                                                                                                                                                                          property 56

                                                                                                                                                                                                                          56: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55;

                                                                                                                                                                                                                            property 57

                                                                                                                                                                                                                            57: Exclude<Range0_63, 57 | 58 | 59 | 60 | 61 | 62 | 63>;

                                                                                                                                                                                                                              property 58

                                                                                                                                                                                                                              58: Exclude<Range0_63, 58 | 59 | 60 | 61 | 62 | 63>;

                                                                                                                                                                                                                                property 59

                                                                                                                                                                                                                                59: Exclude<Range0_63, 59 | 60 | 61 | 62 | 63>;

                                                                                                                                                                                                                                  property 6

                                                                                                                                                                                                                                  6: Range0_3 | 4 | 5;

                                                                                                                                                                                                                                    property 60

                                                                                                                                                                                                                                    60: Exclude<Range0_63, 60 | 61 | 62 | 63>;

                                                                                                                                                                                                                                      property 61

                                                                                                                                                                                                                                      61: Exclude<Range0_63, 61 | 62 | 63>;

                                                                                                                                                                                                                                        property 62

                                                                                                                                                                                                                                        62: Exclude<Range0_63, 62 | 63>;

                                                                                                                                                                                                                                          property 63

                                                                                                                                                                                                                                          63: Exclude<Range0_63, 63>;

                                                                                                                                                                                                                                            property 64

                                                                                                                                                                                                                                            64: Range0_63;

                                                                                                                                                                                                                                              property 7

                                                                                                                                                                                                                                              7: Range0_3 | 4 | 5 | 6;

                                                                                                                                                                                                                                                property 8

                                                                                                                                                                                                                                                8: Range0_7;

                                                                                                                                                                                                                                                  property 9

                                                                                                                                                                                                                                                  9: Range0_7 | 8;

                                                                                                                                                                                                                                                    interface TypedArrayTypeMap

                                                                                                                                                                                                                                                    interface TypedArrayTypeMap extends Record<Type | GLType, TypedArray> {}

                                                                                                                                                                                                                                                      property [GLType.F32]

                                                                                                                                                                                                                                                      [GLType.F32]: Float32Array;

                                                                                                                                                                                                                                                        property [GLType.I16]

                                                                                                                                                                                                                                                        [GLType.I16]: Int16Array;

                                                                                                                                                                                                                                                          property [GLType.I32]

                                                                                                                                                                                                                                                          [GLType.I32]: Int32Array;

                                                                                                                                                                                                                                                            property [GLType.I8]

                                                                                                                                                                                                                                                            [GLType.I8]: Int8Array;

                                                                                                                                                                                                                                                              property [GLType.U16]

                                                                                                                                                                                                                                                              [GLType.U16]: Uint16Array;

                                                                                                                                                                                                                                                                property [GLType.U32]

                                                                                                                                                                                                                                                                [GLType.U32]: Uint32Array;

                                                                                                                                                                                                                                                                  property [GLType.U8]

                                                                                                                                                                                                                                                                  [GLType.U8]: Uint8Array;

                                                                                                                                                                                                                                                                    property f32

                                                                                                                                                                                                                                                                    f32: Float32Array;

                                                                                                                                                                                                                                                                      property f64

                                                                                                                                                                                                                                                                      f64: Float64Array;

                                                                                                                                                                                                                                                                        property i16

                                                                                                                                                                                                                                                                        i16: Int16Array;

                                                                                                                                                                                                                                                                          property i32

                                                                                                                                                                                                                                                                          i32: Int32Array;

                                                                                                                                                                                                                                                                            property i8

                                                                                                                                                                                                                                                                            i8: Int8Array;

                                                                                                                                                                                                                                                                              property u16

                                                                                                                                                                                                                                                                              u16: Uint16Array;

                                                                                                                                                                                                                                                                                property u32

                                                                                                                                                                                                                                                                                u32: Uint32Array;

                                                                                                                                                                                                                                                                                  property u8

                                                                                                                                                                                                                                                                                  u8: Uint8Array;

                                                                                                                                                                                                                                                                                    property u8c

                                                                                                                                                                                                                                                                                    u8c: Uint8ClampedArray;

                                                                                                                                                                                                                                                                                      Enums

                                                                                                                                                                                                                                                                                      enum GLType

                                                                                                                                                                                                                                                                                      enum GLType {
                                                                                                                                                                                                                                                                                      I8 = 5120,
                                                                                                                                                                                                                                                                                      U8 = 5121,
                                                                                                                                                                                                                                                                                      I16 = 5122,
                                                                                                                                                                                                                                                                                      U16 = 5123,
                                                                                                                                                                                                                                                                                      I32 = 5124,
                                                                                                                                                                                                                                                                                      U32 = 5125,
                                                                                                                                                                                                                                                                                      F32 = 5126,
                                                                                                                                                                                                                                                                                      }

                                                                                                                                                                                                                                                                                      member F32

                                                                                                                                                                                                                                                                                      F32 = 5126

                                                                                                                                                                                                                                                                                        member I16

                                                                                                                                                                                                                                                                                        I16 = 5122

                                                                                                                                                                                                                                                                                          member I32

                                                                                                                                                                                                                                                                                          I32 = 5124

                                                                                                                                                                                                                                                                                            member I8

                                                                                                                                                                                                                                                                                            I8 = 5120

                                                                                                                                                                                                                                                                                              member U16

                                                                                                                                                                                                                                                                                              U16 = 5123

                                                                                                                                                                                                                                                                                                member U32

                                                                                                                                                                                                                                                                                                U32 = 5125

                                                                                                                                                                                                                                                                                                  member U8

                                                                                                                                                                                                                                                                                                  U8 = 5121

                                                                                                                                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                                                                                                                                    type Always

                                                                                                                                                                                                                                                                                                    type Always<T> = T extends undefined ? never : T;
                                                                                                                                                                                                                                                                                                    • Similar to NonNullable, but only excludes undefined.

                                                                                                                                                                                                                                                                                                    type ArrayLikeIterable

                                                                                                                                                                                                                                                                                                    type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>;

                                                                                                                                                                                                                                                                                                      type ArrayValue

                                                                                                                                                                                                                                                                                                      type ArrayValue<T extends unknown[]> = T[0];
                                                                                                                                                                                                                                                                                                      • Returns an array's value type. Assumes array is homogeneous (only type of first element will be considered).

                                                                                                                                                                                                                                                                                                      type BigIntArrayConstructor

                                                                                                                                                                                                                                                                                                      type BigIntArrayConstructor = BigInt64ArrayConstructor | BigUint64ArrayConstructor;

                                                                                                                                                                                                                                                                                                        type BigType

                                                                                                                                                                                                                                                                                                        type BigType = 'i64' | 'u64';

                                                                                                                                                                                                                                                                                                          type BigTypedArray

                                                                                                                                                                                                                                                                                                          type BigTypedArray = BigInt64Array | BigUint64Array;

                                                                                                                                                                                                                                                                                                            type ButLast

                                                                                                                                                                                                                                                                                                            type ButLast<T extends unknown[], C extends unknown[] = []> = {
                                                                                                                                                                                                                                                                                                            0: ButLast<Tail<T>, Prepend<Head<T>, C>>;
                                                                                                                                                                                                                                                                                                            1: Reverse<C>;
                                                                                                                                                                                                                                                                                                            }[IsEmpty<Tail<T>>];
                                                                                                                                                                                                                                                                                                            • Extracts everything except the last element from a tuple.

                                                                                                                                                                                                                                                                                                            type Comparator

                                                                                                                                                                                                                                                                                                            type Comparator<T> = Fn2<T, T, number>;
                                                                                                                                                                                                                                                                                                            • Generic 2-element comparator function type alias.

                                                                                                                                                                                                                                                                                                              Remarks

                                                                                                                                                                                                                                                                                                              Must follow this contract and return:

                                                                                                                                                                                                                                                                                                              - negative if a < b - zero if a == b - positive if a > b

                                                                                                                                                                                                                                                                                                            type DeepArrayValue

                                                                                                                                                                                                                                                                                                            type DeepArrayValue<T> = T extends unknown[]
                                                                                                                                                                                                                                                                                                            ? DeepArrayValue<T[0]>
                                                                                                                                                                                                                                                                                                            : T extends TypedArray
                                                                                                                                                                                                                                                                                                            ? number
                                                                                                                                                                                                                                                                                                            : T;
                                                                                                                                                                                                                                                                                                            • Somewhat similar, but recursive version of ArrayValue. If T is an array/typedarray recursively descends into it or (if not an array) returns T. Assumes arrays at each level are homogeneous (only type of first elements will be considered).

                                                                                                                                                                                                                                                                                                            type DeepPartial

                                                                                                                                                                                                                                                                                                            type DeepPartial<T> = Partial<{
                                                                                                                                                                                                                                                                                                            [k in keyof T]: DeepPartial<T[k]>;
                                                                                                                                                                                                                                                                                                            }>;

                                                                                                                                                                                                                                                                                                              type DeepPath

                                                                                                                                                                                                                                                                                                              type DeepPath<T, A, B, C, D, E, F, G, H> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                              ? C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                              ? D extends Keys3<T, A, B, C>
                                                                                                                                                                                                                                                                                                              ? E extends Keys4<T, A, B, C, D>
                                                                                                                                                                                                                                                                                                              ? F extends Keys5<T, A, B, C, D, E>
                                                                                                                                                                                                                                                                                                              ? G extends Keys6<T, A, B, C, D, E, F>
                                                                                                                                                                                                                                                                                                              ? H extends Keys7<T, A, B, C, D, E, F, G>
                                                                                                                                                                                                                                                                                                              ? readonly [A, B, C, D, E, F, G, H, ...NumOrString[]]
                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                              • Semi-typechecked lookup path (depth > 8). Only the first 8 levels are checked.

                                                                                                                                                                                                                                                                                                              type Derefed

                                                                                                                                                                                                                                                                                                              type Derefed<T> = T extends IDeref<any> ? ReturnType<T['deref']> : T;
                                                                                                                                                                                                                                                                                                              • If T is a IDeref, returns its value type or else T.

                                                                                                                                                                                                                                                                                                              type DerefedKeys

                                                                                                                                                                                                                                                                                                              type DerefedKeys<T extends IObjectOf<any>, K extends keyof T = keyof T> = {
                                                                                                                                                                                                                                                                                                              [P in K]: Derefed<T[P]>;
                                                                                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                                                                                              • Constructs a type with a set of properties K of type T and attempts to resolve each given key via Derefed.

                                                                                                                                                                                                                                                                                                                Example 1

                                                                                                                                                                                                                                                                                                                interface Foo {
                                                                                                                                                                                                                                                                                                                a: IDeref<string>;
                                                                                                                                                                                                                                                                                                                b: IDeref<number>;
                                                                                                                                                                                                                                                                                                                c: { d: number };
                                                                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                                                                type Foo2 = DerefedKeys<Foo>;
                                                                                                                                                                                                                                                                                                                // { a: string; b: number; c: { d: number; } }
                                                                                                                                                                                                                                                                                                                type Foo3 = DerefedKeys<Foo, "b">;
                                                                                                                                                                                                                                                                                                                // { b: number; }

                                                                                                                                                                                                                                                                                                              type FloatArray

                                                                                                                                                                                                                                                                                                              type FloatArray = Float32Array | Float64Array;

                                                                                                                                                                                                                                                                                                                type FloatArrayConstructor

                                                                                                                                                                                                                                                                                                                type FloatArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor;

                                                                                                                                                                                                                                                                                                                  type FloatType

                                                                                                                                                                                                                                                                                                                  type FloatType = 'f32' | 'f64';

                                                                                                                                                                                                                                                                                                                    type Fn

                                                                                                                                                                                                                                                                                                                    type Fn<A, B> = (a: A) => B;
                                                                                                                                                                                                                                                                                                                    • A single arg function from A to B.

                                                                                                                                                                                                                                                                                                                    type Fn0

                                                                                                                                                                                                                                                                                                                    type Fn0<T> = () => T;
                                                                                                                                                                                                                                                                                                                    • A no-arg function, returning T.

                                                                                                                                                                                                                                                                                                                    type Fn10

                                                                                                                                                                                                                                                                                                                    type Fn10<A, B, C, D, E, F, G, H, I, J, K> = (
                                                                                                                                                                                                                                                                                                                    a: A,
                                                                                                                                                                                                                                                                                                                    b: B,
                                                                                                                                                                                                                                                                                                                    c: C,
                                                                                                                                                                                                                                                                                                                    d: D,
                                                                                                                                                                                                                                                                                                                    e: E,
                                                                                                                                                                                                                                                                                                                    f: F,
                                                                                                                                                                                                                                                                                                                    g: G,
                                                                                                                                                                                                                                                                                                                    h: H,
                                                                                                                                                                                                                                                                                                                    i: I,
                                                                                                                                                                                                                                                                                                                    j: J
                                                                                                                                                                                                                                                                                                                    ) => K;
                                                                                                                                                                                                                                                                                                                    • A 10-arg function from A,B,C,D,E,F,G,H,I,J to K.

                                                                                                                                                                                                                                                                                                                    type Fn2

                                                                                                                                                                                                                                                                                                                    type Fn2<A, B, C> = (a: A, b: B) => C;
                                                                                                                                                                                                                                                                                                                    • A 2-arg function from A,B to C.

                                                                                                                                                                                                                                                                                                                    type Fn3

                                                                                                                                                                                                                                                                                                                    type Fn3<A, B, C, D> = (a: A, b: B, c: C) => D;
                                                                                                                                                                                                                                                                                                                    • A 3-arg function from A,B,C to D.

                                                                                                                                                                                                                                                                                                                    type Fn4

                                                                                                                                                                                                                                                                                                                    type Fn4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E;
                                                                                                                                                                                                                                                                                                                    • A 4-arg function from A,B,C,D to E.

                                                                                                                                                                                                                                                                                                                    type Fn5

                                                                                                                                                                                                                                                                                                                    type Fn5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F;
                                                                                                                                                                                                                                                                                                                    • A 5-arg function from A,B,C,D,E to F.

                                                                                                                                                                                                                                                                                                                    type Fn6

                                                                                                                                                                                                                                                                                                                    type Fn6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G;
                                                                                                                                                                                                                                                                                                                    • A 6-arg function from A,B,C,D,E,F to G.

                                                                                                                                                                                                                                                                                                                    type Fn7

                                                                                                                                                                                                                                                                                                                    type Fn7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H;
                                                                                                                                                                                                                                                                                                                    • A 7-arg function from A,B,C,D,E,F,G to H.

                                                                                                                                                                                                                                                                                                                    type Fn8

                                                                                                                                                                                                                                                                                                                    type Fn8<A, B, C, D, E, F, G, H, I> = (
                                                                                                                                                                                                                                                                                                                    a: A,
                                                                                                                                                                                                                                                                                                                    b: B,
                                                                                                                                                                                                                                                                                                                    c: C,
                                                                                                                                                                                                                                                                                                                    d: D,
                                                                                                                                                                                                                                                                                                                    e: E,
                                                                                                                                                                                                                                                                                                                    f: F,
                                                                                                                                                                                                                                                                                                                    g: G,
                                                                                                                                                                                                                                                                                                                    h: H
                                                                                                                                                                                                                                                                                                                    ) => I;
                                                                                                                                                                                                                                                                                                                    • A 8-arg function from A,B,C,D,E,F,G,H to I.

                                                                                                                                                                                                                                                                                                                    type Fn9

                                                                                                                                                                                                                                                                                                                    type Fn9<A, B, C, D, E, F, G, H, I, J> = (
                                                                                                                                                                                                                                                                                                                    a: A,
                                                                                                                                                                                                                                                                                                                    b: B,
                                                                                                                                                                                                                                                                                                                    c: C,
                                                                                                                                                                                                                                                                                                                    d: D,
                                                                                                                                                                                                                                                                                                                    e: E,
                                                                                                                                                                                                                                                                                                                    f: F,
                                                                                                                                                                                                                                                                                                                    g: G,
                                                                                                                                                                                                                                                                                                                    h: H,
                                                                                                                                                                                                                                                                                                                    i: I
                                                                                                                                                                                                                                                                                                                    ) => J;
                                                                                                                                                                                                                                                                                                                    • A 9-arg function from A,B,C,D,E,F,G,H,I to J.

                                                                                                                                                                                                                                                                                                                    type FnAny

                                                                                                                                                                                                                                                                                                                    type FnAny<T> = (...xs: any[]) => T;
                                                                                                                                                                                                                                                                                                                    • An untyped vararg arg function to type T.

                                                                                                                                                                                                                                                                                                                    type FnAnyT

                                                                                                                                                                                                                                                                                                                    type FnAnyT<A, B> = (...xs: A[]) => B;
                                                                                                                                                                                                                                                                                                                    • A typed vararg arg function from A to B.

                                                                                                                                                                                                                                                                                                                    type FnN

                                                                                                                                                                                                                                                                                                                    type FnN = FnU<number>;

                                                                                                                                                                                                                                                                                                                      type FnN10

                                                                                                                                                                                                                                                                                                                      type FnN10 = FnU10<number>;

                                                                                                                                                                                                                                                                                                                        type FnN2

                                                                                                                                                                                                                                                                                                                        type FnN2 = FnU2<number>;

                                                                                                                                                                                                                                                                                                                          type FnN3

                                                                                                                                                                                                                                                                                                                          type FnN3 = FnU3<number>;

                                                                                                                                                                                                                                                                                                                            type FnN4

                                                                                                                                                                                                                                                                                                                            type FnN4 = FnU4<number>;

                                                                                                                                                                                                                                                                                                                              type FnN5

                                                                                                                                                                                                                                                                                                                              type FnN5 = FnU5<number>;

                                                                                                                                                                                                                                                                                                                                type FnN6

                                                                                                                                                                                                                                                                                                                                type FnN6 = FnU6<number>;

                                                                                                                                                                                                                                                                                                                                  type FnN7

                                                                                                                                                                                                                                                                                                                                  type FnN7 = FnU7<number>;

                                                                                                                                                                                                                                                                                                                                    type FnN8

                                                                                                                                                                                                                                                                                                                                    type FnN8 = FnU8<number>;

                                                                                                                                                                                                                                                                                                                                      type FnN9

                                                                                                                                                                                                                                                                                                                                      type FnN9 = FnU9<number>;

                                                                                                                                                                                                                                                                                                                                        type FnO

                                                                                                                                                                                                                                                                                                                                        type FnO<A, B> = (a: A, ...xs: any[]) => B;

                                                                                                                                                                                                                                                                                                                                          type FnO10

                                                                                                                                                                                                                                                                                                                                          type FnO10<A, B, C, D, E, F, G, H, I, J, K> = (
                                                                                                                                                                                                                                                                                                                                          a: A,
                                                                                                                                                                                                                                                                                                                                          b: B,
                                                                                                                                                                                                                                                                                                                                          c: C,
                                                                                                                                                                                                                                                                                                                                          d: D,
                                                                                                                                                                                                                                                                                                                                          e: E,
                                                                                                                                                                                                                                                                                                                                          f: F,
                                                                                                                                                                                                                                                                                                                                          g: G,
                                                                                                                                                                                                                                                                                                                                          h: H,
                                                                                                                                                                                                                                                                                                                                          i: I,
                                                                                                                                                                                                                                                                                                                                          j: J,
                                                                                                                                                                                                                                                                                                                                          ...xs: any[]
                                                                                                                                                                                                                                                                                                                                          ) => K;

                                                                                                                                                                                                                                                                                                                                            type FnO2

                                                                                                                                                                                                                                                                                                                                            type FnO2<A, B, C> = (a: A, b: B, ...xs: any[]) => C;

                                                                                                                                                                                                                                                                                                                                              type FnO3

                                                                                                                                                                                                                                                                                                                                              type FnO3<A, B, C, D> = (a: A, b: B, c: C, ...xs: any[]) => D;

                                                                                                                                                                                                                                                                                                                                                type FnO4

                                                                                                                                                                                                                                                                                                                                                type FnO4<A, B, C, D, E> = (a: A, b: B, c: C, d: D, ...xs: any[]) => E;

                                                                                                                                                                                                                                                                                                                                                  type FnO5

                                                                                                                                                                                                                                                                                                                                                  type FnO5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E, ...xs: any[]) => F;

                                                                                                                                                                                                                                                                                                                                                    type FnO6

                                                                                                                                                                                                                                                                                                                                                    type FnO6<A, B, C, D, E, F, G> = (
                                                                                                                                                                                                                                                                                                                                                    a: A,
                                                                                                                                                                                                                                                                                                                                                    b: B,
                                                                                                                                                                                                                                                                                                                                                    c: C,
                                                                                                                                                                                                                                                                                                                                                    d: D,
                                                                                                                                                                                                                                                                                                                                                    e: E,
                                                                                                                                                                                                                                                                                                                                                    f: F,
                                                                                                                                                                                                                                                                                                                                                    ...xs: any[]
                                                                                                                                                                                                                                                                                                                                                    ) => G;

                                                                                                                                                                                                                                                                                                                                                      type FnO7

                                                                                                                                                                                                                                                                                                                                                      type FnO7<A, B, C, D, E, F, G, H> = (
                                                                                                                                                                                                                                                                                                                                                      a: A,
                                                                                                                                                                                                                                                                                                                                                      b: B,
                                                                                                                                                                                                                                                                                                                                                      c: C,
                                                                                                                                                                                                                                                                                                                                                      d: D,
                                                                                                                                                                                                                                                                                                                                                      e: E,
                                                                                                                                                                                                                                                                                                                                                      f: F,
                                                                                                                                                                                                                                                                                                                                                      g: G,
                                                                                                                                                                                                                                                                                                                                                      ...xs: any[]
                                                                                                                                                                                                                                                                                                                                                      ) => H;

                                                                                                                                                                                                                                                                                                                                                        type FnO8

                                                                                                                                                                                                                                                                                                                                                        type FnO8<A, B, C, D, E, F, G, H, I> = (
                                                                                                                                                                                                                                                                                                                                                        a: A,
                                                                                                                                                                                                                                                                                                                                                        b: B,
                                                                                                                                                                                                                                                                                                                                                        c: C,
                                                                                                                                                                                                                                                                                                                                                        d: D,
                                                                                                                                                                                                                                                                                                                                                        e: E,
                                                                                                                                                                                                                                                                                                                                                        f: F,
                                                                                                                                                                                                                                                                                                                                                        g: G,
                                                                                                                                                                                                                                                                                                                                                        h: H,
                                                                                                                                                                                                                                                                                                                                                        ...xs: any[]
                                                                                                                                                                                                                                                                                                                                                        ) => I;

                                                                                                                                                                                                                                                                                                                                                          type FnO9

                                                                                                                                                                                                                                                                                                                                                          type FnO9<A, B, C, D, E, F, G, H, I, J> = (
                                                                                                                                                                                                                                                                                                                                                          a: A,
                                                                                                                                                                                                                                                                                                                                                          b: B,
                                                                                                                                                                                                                                                                                                                                                          c: C,
                                                                                                                                                                                                                                                                                                                                                          d: D,
                                                                                                                                                                                                                                                                                                                                                          e: E,
                                                                                                                                                                                                                                                                                                                                                          f: F,
                                                                                                                                                                                                                                                                                                                                                          g: G,
                                                                                                                                                                                                                                                                                                                                                          h: H,
                                                                                                                                                                                                                                                                                                                                                          i: I,
                                                                                                                                                                                                                                                                                                                                                          ...xs: any[]
                                                                                                                                                                                                                                                                                                                                                          ) => J;

                                                                                                                                                                                                                                                                                                                                                            type FnU

                                                                                                                                                                                                                                                                                                                                                            type FnU<A, B = A> = Fn<A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 1-arg function with arg of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU10

                                                                                                                                                                                                                                                                                                                                                            type FnU10<A, B = A> = Fn10<A, A, A, A, A, A, A, A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 10-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU2

                                                                                                                                                                                                                                                                                                                                                            type FnU2<A, B = A> = Fn2<A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 2-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU3

                                                                                                                                                                                                                                                                                                                                                            type FnU3<A, B = A> = Fn3<A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 3-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU4

                                                                                                                                                                                                                                                                                                                                                            type FnU4<A, B = A> = Fn4<A, A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 4-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU5

                                                                                                                                                                                                                                                                                                                                                            type FnU5<A, B = A> = Fn5<A, A, A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 5-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU6

                                                                                                                                                                                                                                                                                                                                                            type FnU6<A, B = A> = Fn6<A, A, A, A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 6-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU7

                                                                                                                                                                                                                                                                                                                                                            type FnU7<A, B = A> = Fn7<A, A, A, A, A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 7-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU8

                                                                                                                                                                                                                                                                                                                                                            type FnU8<A, B = A> = Fn8<A, A, A, A, A, A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 8-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type FnU9

                                                                                                                                                                                                                                                                                                                                                            type FnU9<A, B = A> = Fn9<A, A, A, A, A, A, A, A, A, B>;
                                                                                                                                                                                                                                                                                                                                                            • 9-arg function with all args uniformly of type A and return type B (defaults to A)

                                                                                                                                                                                                                                                                                                                                                            type Head<T extends unknown[]> = T extends [infer A, ...unknown[]] ? A : never;
                                                                                                                                                                                                                                                                                                                                                            • Extracts the first element of a tuple.

                                                                                                                                                                                                                                                                                                                                                            type IntArray

                                                                                                                                                                                                                                                                                                                                                            type IntArray = Int8Array | Int16Array | Int32Array;

                                                                                                                                                                                                                                                                                                                                                              type IntArrayConstructor

                                                                                                                                                                                                                                                                                                                                                              type IntArrayConstructor =
                                                                                                                                                                                                                                                                                                                                                              | Int8ArrayConstructor
                                                                                                                                                                                                                                                                                                                                                              | Int16ArrayConstructor
                                                                                                                                                                                                                                                                                                                                                              | Int32ArrayConstructor;

                                                                                                                                                                                                                                                                                                                                                                type IntType

                                                                                                                                                                                                                                                                                                                                                                type IntType = 'i8' | 'i16' | 'i32';

                                                                                                                                                                                                                                                                                                                                                                  type IsEmpty

                                                                                                                                                                                                                                                                                                                                                                  type IsEmpty<T extends unknown[]> = T extends [] ? 1 : 0;
                                                                                                                                                                                                                                                                                                                                                                  • Returns 1 if T is empty tuple, else 0

                                                                                                                                                                                                                                                                                                                                                                  type IsOpt

                                                                                                                                                                                                                                                                                                                                                                  type IsOpt<T> = T extends undefined ? true : never;
                                                                                                                                                                                                                                                                                                                                                                  • Returns true if T includes undefined.

                                                                                                                                                                                                                                                                                                                                                                  type IsOptPath

                                                                                                                                                                                                                                                                                                                                                                  type IsOptPath<T, P extends unknown[]> = P extends []
                                                                                                                                                                                                                                                                                                                                                                  ? never
                                                                                                                                                                                                                                                                                                                                                                  : IsOptR<T, Head<P>, Tail<P>>;
                                                                                                                                                                                                                                                                                                                                                                  • Returns true if given path contains any intermediate properties declared as optional in type T.

                                                                                                                                                                                                                                                                                                                                                                    Reference: https://stackoverflow.com/q/60869412/294515

                                                                                                                                                                                                                                                                                                                                                                  type Keys

                                                                                                                                                                                                                                                                                                                                                                  type Keys<T> = keyof Required<T>;

                                                                                                                                                                                                                                                                                                                                                                    type Keys1

                                                                                                                                                                                                                                                                                                                                                                    type Keys1<T, A extends Keys<T>> = Keys<Required<T>[A]>;

                                                                                                                                                                                                                                                                                                                                                                      type Keys2

                                                                                                                                                                                                                                                                                                                                                                      type Keys2<T, A extends Keys<T>, B extends Keys1<T, A>> = Keys1<Required<T>[A], B>;

                                                                                                                                                                                                                                                                                                                                                                        type Keys3

                                                                                                                                                                                                                                                                                                                                                                        type Keys3<
                                                                                                                                                                                                                                                                                                                                                                        T,
                                                                                                                                                                                                                                                                                                                                                                        A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                        B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                        C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                                                                                        > = Keys2<Required<T>[A], B, C>;

                                                                                                                                                                                                                                                                                                                                                                          type Keys4

                                                                                                                                                                                                                                                                                                                                                                          type Keys4<
                                                                                                                                                                                                                                                                                                                                                                          T,
                                                                                                                                                                                                                                                                                                                                                                          A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                          B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                          C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                          D extends Keys3<T, A, B, C>
                                                                                                                                                                                                                                                                                                                                                                          > = Keys3<Required<T>[A], B, C, D>;

                                                                                                                                                                                                                                                                                                                                                                            type Keys5

                                                                                                                                                                                                                                                                                                                                                                            type Keys5<
                                                                                                                                                                                                                                                                                                                                                                            T,
                                                                                                                                                                                                                                                                                                                                                                            A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                            B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                            C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                            D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                            E extends Keys4<T, A, B, C, D>
                                                                                                                                                                                                                                                                                                                                                                            > = Keys4<Required<T>[A], B, C, D, E>;

                                                                                                                                                                                                                                                                                                                                                                              type Keys6

                                                                                                                                                                                                                                                                                                                                                                              type Keys6<
                                                                                                                                                                                                                                                                                                                                                                              T,
                                                                                                                                                                                                                                                                                                                                                                              A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                              B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                              C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                              D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                              E extends Keys4<T, A, B, C, D>,
                                                                                                                                                                                                                                                                                                                                                                              F extends Keys5<T, A, B, C, D, E>
                                                                                                                                                                                                                                                                                                                                                                              > = Keys5<Required<T>[A], B, C, D, E, F>;

                                                                                                                                                                                                                                                                                                                                                                                type Keys7

                                                                                                                                                                                                                                                                                                                                                                                type Keys7<
                                                                                                                                                                                                                                                                                                                                                                                T,
                                                                                                                                                                                                                                                                                                                                                                                A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                                E extends Keys4<T, A, B, C, D>,
                                                                                                                                                                                                                                                                                                                                                                                F extends Keys5<T, A, B, C, D, E>,
                                                                                                                                                                                                                                                                                                                                                                                G extends Keys6<T, A, B, C, D, E, F>
                                                                                                                                                                                                                                                                                                                                                                                > = Keys6<Required<T>[A], B, C, D, E, F, G>;

                                                                                                                                                                                                                                                                                                                                                                                  type Keys8

                                                                                                                                                                                                                                                                                                                                                                                  type Keys8<
                                                                                                                                                                                                                                                                                                                                                                                  T,
                                                                                                                                                                                                                                                                                                                                                                                  A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                  B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                  C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                  D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                                  E extends Keys4<T, A, B, C, D>,
                                                                                                                                                                                                                                                                                                                                                                                  F extends Keys5<T, A, B, C, D, E>,
                                                                                                                                                                                                                                                                                                                                                                                  G extends Keys6<T, A, B, C, D, E, F>,
                                                                                                                                                                                                                                                                                                                                                                                  H extends Keys7<T, A, B, C, D, E, F, G>
                                                                                                                                                                                                                                                                                                                                                                                  > = Keys7<Required<T>[A], B, C, D, E, F, G, H>;

                                                                                                                                                                                                                                                                                                                                                                                    type KeysN

                                                                                                                                                                                                                                                                                                                                                                                    type KeysN<T, L extends unknown[]> = L extends []
                                                                                                                                                                                                                                                                                                                                                                                    ? Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                    : KeysNReducer<T, Head<L>, Tail<L>>;
                                                                                                                                                                                                                                                                                                                                                                                    • Generalised version of Keys0 - Keys7.

                                                                                                                                                                                                                                                                                                                                                                                    type Last

                                                                                                                                                                                                                                                                                                                                                                                    type Last<T extends unknown[]> = {
                                                                                                                                                                                                                                                                                                                                                                                    0: Last<Tail<T>>;
                                                                                                                                                                                                                                                                                                                                                                                    1: Head<T>;
                                                                                                                                                                                                                                                                                                                                                                                    }[IsEmpty<Tail<T>>];
                                                                                                                                                                                                                                                                                                                                                                                    • Extracts the last element from a tuple.

                                                                                                                                                                                                                                                                                                                                                                                    type Listener

                                                                                                                                                                                                                                                                                                                                                                                    type Listener = Fn<Event, void>;
                                                                                                                                                                                                                                                                                                                                                                                    • Event listener.

                                                                                                                                                                                                                                                                                                                                                                                    type MaybeDeref

                                                                                                                                                                                                                                                                                                                                                                                    type MaybeDeref<T> = IDeref<T> | T;

                                                                                                                                                                                                                                                                                                                                                                                      type Nullable

                                                                                                                                                                                                                                                                                                                                                                                      type Nullable<T> = T | null | undefined;

                                                                                                                                                                                                                                                                                                                                                                                        type NumericArray

                                                                                                                                                                                                                                                                                                                                                                                        type NumericArray = number[] | TypedArray;

                                                                                                                                                                                                                                                                                                                                                                                          type NumericKeys

                                                                                                                                                                                                                                                                                                                                                                                          type NumericKeys<T> = TypedKeys<T, number>;

                                                                                                                                                                                                                                                                                                                                                                                            type NumOrString

                                                                                                                                                                                                                                                                                                                                                                                            type NumOrString = number | string;

                                                                                                                                                                                                                                                                                                                                                                                              type OptPathVal

                                                                                                                                                                                                                                                                                                                                                                                              type OptPathVal<T, P extends unknown[]> = OptVal<IsOptPath<T, P>, ValN<T, P>>;
                                                                                                                                                                                                                                                                                                                                                                                              • Similar to PathVal, but also takes into account if given path contains any intermediate properties declared as optional in type T. If that's the case, returns union of undefined and inferred value for path, else just the latter.

                                                                                                                                                                                                                                                                                                                                                                                                Context & reference: https://stackoverflow.com/q/60869412/294515

                                                                                                                                                                                                                                                                                                                                                                                              type OptVal

                                                                                                                                                                                                                                                                                                                                                                                              type OptVal<PRED, RES> = [PRED] extends [never] ? RES : RES | undefined;
                                                                                                                                                                                                                                                                                                                                                                                              • Returns RES if PRED is never, else RES | undefined

                                                                                                                                                                                                                                                                                                                                                                                              type Pair

                                                                                                                                                                                                                                                                                                                                                                                              type Pair<K, V> = [K, V];
                                                                                                                                                                                                                                                                                                                                                                                              • A key-value pair / tuple.

                                                                                                                                                                                                                                                                                                                                                                                              type Path

                                                                                                                                                                                                                                                                                                                                                                                              type Path = readonly NumOrString[] | NumOrString;
                                                                                                                                                                                                                                                                                                                                                                                              • Unchecked lookup path for nested data structures.

                                                                                                                                                                                                                                                                                                                                                                                              type Path0

                                                                                                                                                                                                                                                                                                                                                                                              type Path0 = readonly [];
                                                                                                                                                                                                                                                                                                                                                                                              • Empty lookup path.

                                                                                                                                                                                                                                                                                                                                                                                              type Path1

                                                                                                                                                                                                                                                                                                                                                                                              type Path1<T, A> = A extends Keys<T> ? readonly [A] : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 1)

                                                                                                                                                                                                                                                                                                                                                                                              type Path2

                                                                                                                                                                                                                                                                                                                                                                                              type Path2<T, A, B> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                                                                                                              ? readonly [A, B]
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 2)

                                                                                                                                                                                                                                                                                                                                                                                              type Path3

                                                                                                                                                                                                                                                                                                                                                                                              type Path3<T, A, B, C> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                                                                                                              ? C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                                                                                                              ? readonly [A, B, C]
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 3)

                                                                                                                                                                                                                                                                                                                                                                                              type Path4

                                                                                                                                                                                                                                                                                                                                                                                              type Path4<T, A, B, C, D> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                                                                                                              ? C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                                                                                                              ? D extends Keys3<T, A, B, C>
                                                                                                                                                                                                                                                                                                                                                                                              ? readonly [A, B, C, D]
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 4)

                                                                                                                                                                                                                                                                                                                                                                                              type Path5

                                                                                                                                                                                                                                                                                                                                                                                              type Path5<T, A, B, C, D, E> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                                                                                                              ? C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                                                                                                              ? D extends Keys3<T, A, B, C>
                                                                                                                                                                                                                                                                                                                                                                                              ? E extends Keys4<T, A, B, C, D>
                                                                                                                                                                                                                                                                                                                                                                                              ? readonly [A, B, C, D, E]
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 5)

                                                                                                                                                                                                                                                                                                                                                                                              type Path6

                                                                                                                                                                                                                                                                                                                                                                                              type Path6<T, A, B, C, D, E, F> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                                                                                                              ? C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                                                                                                              ? D extends Keys3<T, A, B, C>
                                                                                                                                                                                                                                                                                                                                                                                              ? E extends Keys4<T, A, B, C, D>
                                                                                                                                                                                                                                                                                                                                                                                              ? F extends Keys5<T, A, B, C, D, E>
                                                                                                                                                                                                                                                                                                                                                                                              ? readonly [A, B, C, D, E, F]
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 6)

                                                                                                                                                                                                                                                                                                                                                                                              type Path7

                                                                                                                                                                                                                                                                                                                                                                                              type Path7<T, A, B, C, D, E, F, G> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                                                                                                              ? C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                                                                                                              ? D extends Keys3<T, A, B, C>
                                                                                                                                                                                                                                                                                                                                                                                              ? E extends Keys4<T, A, B, C, D>
                                                                                                                                                                                                                                                                                                                                                                                              ? F extends Keys5<T, A, B, C, D, E>
                                                                                                                                                                                                                                                                                                                                                                                              ? G extends Keys6<T, A, B, C, D, E, F>
                                                                                                                                                                                                                                                                                                                                                                                              ? readonly [A, B, C, D, E, F, G]
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 7)

                                                                                                                                                                                                                                                                                                                                                                                              type Path8

                                                                                                                                                                                                                                                                                                                                                                                              type Path8<T, A, B, C, D, E, F, G, H> = A extends Keys<T>
                                                                                                                                                                                                                                                                                                                                                                                              ? B extends Keys1<T, A>
                                                                                                                                                                                                                                                                                                                                                                                              ? C extends Keys2<T, A, B>
                                                                                                                                                                                                                                                                                                                                                                                              ? D extends Keys3<T, A, B, C>
                                                                                                                                                                                                                                                                                                                                                                                              ? E extends Keys4<T, A, B, C, D>
                                                                                                                                                                                                                                                                                                                                                                                              ? F extends Keys5<T, A, B, C, D, E>
                                                                                                                                                                                                                                                                                                                                                                                              ? G extends Keys6<T, A, B, C, D, E, F>
                                                                                                                                                                                                                                                                                                                                                                                              ? H extends Keys7<T, A, B, C, D, E, F, G>
                                                                                                                                                                                                                                                                                                                                                                                              ? readonly [A, B, C, D, E, F, G, H]
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never
                                                                                                                                                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                                                                                                                                                              • Type checked lookup path (depth 8)

                                                                                                                                                                                                                                                                                                                                                                                              type PathVal

                                                                                                                                                                                                                                                                                                                                                                                              type PathVal<T, P extends unknown[]> = ValN<T, P>;
                                                                                                                                                                                                                                                                                                                                                                                              • Returns nested value type for given path into T or never if path is incompatible with T.

                                                                                                                                                                                                                                                                                                                                                                                              type Predicate

                                                                                                                                                                                                                                                                                                                                                                                              type Predicate<T> = Fn<T, boolean>;
                                                                                                                                                                                                                                                                                                                                                                                              • Predicate function mapping given value to true/false.

                                                                                                                                                                                                                                                                                                                                                                                              type Predicate2

                                                                                                                                                                                                                                                                                                                                                                                              type Predicate2<T> = Fn2<T, T, boolean>;
                                                                                                                                                                                                                                                                                                                                                                                              • Predicate function mapping given args to true/false.

                                                                                                                                                                                                                                                                                                                                                                                              type Prepend

                                                                                                                                                                                                                                                                                                                                                                                              type Prepend<T, U extends unknown[]> = [T, ...U];
                                                                                                                                                                                                                                                                                                                                                                                              • Adds an element at the start of an tuple.

                                                                                                                                                                                                                                                                                                                                                                                              type Primitive

                                                                                                                                                                                                                                                                                                                                                                                              type Primitive = NumOrString | boolean | symbol;

                                                                                                                                                                                                                                                                                                                                                                                                type Range

                                                                                                                                                                                                                                                                                                                                                                                                type Range = [number, number];

                                                                                                                                                                                                                                                                                                                                                                                                  type Range0_1

                                                                                                                                                                                                                                                                                                                                                                                                  type Range0_1 = 0 | 1;

                                                                                                                                                                                                                                                                                                                                                                                                    type Range0_15

                                                                                                                                                                                                                                                                                                                                                                                                    type Range0_15 = Range0_7 | Range8_15;

                                                                                                                                                                                                                                                                                                                                                                                                      type Range0_23

                                                                                                                                                                                                                                                                                                                                                                                                      type Range0_23 = Range0_15 | Range16_23;

                                                                                                                                                                                                                                                                                                                                                                                                        type Range0_3

                                                                                                                                                                                                                                                                                                                                                                                                        type Range0_3 = Range0_1 | 2 | 3;

                                                                                                                                                                                                                                                                                                                                                                                                          type Range0_31

                                                                                                                                                                                                                                                                                                                                                                                                          type Range0_31 = Range0_15 | Range16_31;

                                                                                                                                                                                                                                                                                                                                                                                                            type Range0_47

                                                                                                                                                                                                                                                                                                                                                                                                            type Range0_47 = Range0_31 | Range32_47;

                                                                                                                                                                                                                                                                                                                                                                                                              type Range0_63

                                                                                                                                                                                                                                                                                                                                                                                                              type Range0_63 = Range0_31 | Range32_63;

                                                                                                                                                                                                                                                                                                                                                                                                                type Range0_7

                                                                                                                                                                                                                                                                                                                                                                                                                type Range0_7 = Range0_3 | Range4_7;

                                                                                                                                                                                                                                                                                                                                                                                                                  type Range1_16

                                                                                                                                                                                                                                                                                                                                                                                                                  type Range1_16 = Range1_8 | Range8_15 | 16;

                                                                                                                                                                                                                                                                                                                                                                                                                    type Range1_2

                                                                                                                                                                                                                                                                                                                                                                                                                    type Range1_2 = 1 | 2;

                                                                                                                                                                                                                                                                                                                                                                                                                      type Range1_24

                                                                                                                                                                                                                                                                                                                                                                                                                      type Range1_24 = Range1_16 | Range16_23 | 24;

                                                                                                                                                                                                                                                                                                                                                                                                                        type Range1_32

                                                                                                                                                                                                                                                                                                                                                                                                                        type Range1_32 = Range1_16 | Range16_31 | 32;

                                                                                                                                                                                                                                                                                                                                                                                                                          type Range1_4

                                                                                                                                                                                                                                                                                                                                                                                                                          type Range1_4 = Range1_2 | 3 | 4;

                                                                                                                                                                                                                                                                                                                                                                                                                            type Range1_48

                                                                                                                                                                                                                                                                                                                                                                                                                            type Range1_48 = Range1_32 | Range32_47 | 48;

                                                                                                                                                                                                                                                                                                                                                                                                                              type Range1_64

                                                                                                                                                                                                                                                                                                                                                                                                                              type Range1_64 = Range1_32 | Range32_63 | 64;

                                                                                                                                                                                                                                                                                                                                                                                                                                type Range1_8

                                                                                                                                                                                                                                                                                                                                                                                                                                type Range1_8 = Range1_4 | Range4_7 | 8;

                                                                                                                                                                                                                                                                                                                                                                                                                                  type Range16_23

                                                                                                                                                                                                                                                                                                                                                                                                                                  type Range16_23 = 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;

                                                                                                                                                                                                                                                                                                                                                                                                                                    type Range16_31

                                                                                                                                                                                                                                                                                                                                                                                                                                    type Range16_31 = Range16_23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;

                                                                                                                                                                                                                                                                                                                                                                                                                                      type Range32_47

                                                                                                                                                                                                                                                                                                                                                                                                                                      type Range32_47 =
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 32
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 33
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 34
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 35
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 36
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 37
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 38
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 39
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 40
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 41
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 42
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 43
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 44
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 45
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 46
                                                                                                                                                                                                                                                                                                                                                                                                                                      | 47;

                                                                                                                                                                                                                                                                                                                                                                                                                                        type Range32_63

                                                                                                                                                                                                                                                                                                                                                                                                                                        type Range32_63 = Range32_47 | Range48_63;

                                                                                                                                                                                                                                                                                                                                                                                                                                          type Range4_7

                                                                                                                                                                                                                                                                                                                                                                                                                                          type Range4_7 = 4 | 5 | 6 | 7;

                                                                                                                                                                                                                                                                                                                                                                                                                                            type Range48_63

                                                                                                                                                                                                                                                                                                                                                                                                                                            type Range48_63 =
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 48
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 49
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 50
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 51
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 52
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 53
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 54
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 55
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 56
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 57
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 58
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 59
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 60
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 61
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 62
                                                                                                                                                                                                                                                                                                                                                                                                                                            | 63;

                                                                                                                                                                                                                                                                                                                                                                                                                                              type Range8_15

                                                                                                                                                                                                                                                                                                                                                                                                                                              type Range8_15 = 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;

                                                                                                                                                                                                                                                                                                                                                                                                                                                type Replace

                                                                                                                                                                                                                                                                                                                                                                                                                                                type Replace<T, A extends Keys<T>, V> = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                [id in A]: V;
                                                                                                                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Utilities for replacing types of nested keys.

                                                                                                                                                                                                                                                                                                                                                                                                                                                type Replace2

                                                                                                                                                                                                                                                                                                                                                                                                                                                type Replace2<T, A extends Keys<T>, B extends Keys1<T, A>, V> = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                [id in A]: Replace<Val1<T, A>, B, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                                                                                                                  type Replace3

                                                                                                                                                                                                                                                                                                                                                                                                                                                  type Replace3<
                                                                                                                                                                                                                                                                                                                                                                                                                                                  T,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  V
                                                                                                                                                                                                                                                                                                                                                                                                                                                  > = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  [id in A]: Replace2<Val1<T, A>, B, C, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                                                                                                                                                                                                                                    type Replace4

                                                                                                                                                                                                                                                                                                                                                                                                                                                    type Replace4<
                                                                                                                                                                                                                                                                                                                                                                                                                                                    T,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    V
                                                                                                                                                                                                                                                                                                                                                                                                                                                    > = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    [id in A]: Replace3<Val1<T, A>, B, C, D, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                                                                                                                                                                                                                                      type Replace5

                                                                                                                                                                                                                                                                                                                                                                                                                                                      type Replace5<
                                                                                                                                                                                                                                                                                                                                                                                                                                                      T,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      E extends Keys4<T, A, B, C, D>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      V
                                                                                                                                                                                                                                                                                                                                                                                                                                                      > = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                      [id in A]: Replace4<Val1<T, A>, B, C, D, E, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                                                                                                                                                                                                                        type Replace6

                                                                                                                                                                                                                                                                                                                                                                                                                                                        type Replace6<
                                                                                                                                                                                                                                                                                                                                                                                                                                                        T,
                                                                                                                                                                                                                                                                                                                                                                                                                                                        A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                        B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                        C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                        D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                        E extends Keys4<T, A, B, C, D>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                        F extends Keys5<T, A, B, C, D, E>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                        V
                                                                                                                                                                                                                                                                                                                                                                                                                                                        > = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                        [id in A]: Replace5<Val1<T, A>, B, C, D, E, F, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                        };

                                                                                                                                                                                                                                                                                                                                                                                                                                                          type Replace7

                                                                                                                                                                                                                                                                                                                                                                                                                                                          type Replace7<
                                                                                                                                                                                                                                                                                                                                                                                                                                                          T,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          E extends Keys4<T, A, B, C, D>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          F extends Keys5<T, A, B, C, D, E>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          G extends Keys6<T, A, B, C, D, E, F>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          V
                                                                                                                                                                                                                                                                                                                                                                                                                                                          > = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          [id in A]: Replace6<Val1<T, A>, B, C, D, E, F, G, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                                                                                                                                                                                                                                            type Replace8

                                                                                                                                                                                                                                                                                                                                                                                                                                                            type Replace8<
                                                                                                                                                                                                                                                                                                                                                                                                                                                            T,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            A extends Keys<T>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            B extends Keys1<T, A>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            C extends Keys2<T, A, B>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            D extends Keys3<T, A, B, C>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            E extends Keys4<T, A, B, C, D>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            F extends Keys5<T, A, B, C, D, E>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            G extends Keys6<T, A, B, C, D, E, F>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            H extends Keys7<T, A, B, C, D, E, F, G>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            V
                                                                                                                                                                                                                                                                                                                                                                                                                                                            > = Without<T, A> & {
                                                                                                                                                                                                                                                                                                                                                                                                                                                            [id in A]: Replace7<Val1<T, A>, B, C, D, E, F, G, H, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            };

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type ReplaceN

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type ReplaceN<T, P extends unknown[], V> = ReplaceNReducer<T, Head<P>, Tail<P>, V>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Generalised version of Replace0-Replace8.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type Reverse

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type Reverse<T extends unknown[]> = ReverseReducer<T, []>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Reverses the order of elements from a tuple.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type Select2

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type Select2<T, Q, A, B> = T extends Q ? A : B;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                type Select3

                                                                                                                                                                                                                                                                                                                                                                                                                                                                type Select3<T, Q1, Q2, A, B, C> = T extends Q1 ? A : T extends Q2 ? B : C;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type Select4

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type Select4<T, Q1, Q2, Q3, A, B, C, D> = T extends Q1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ? A
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  : T extends Q2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ? B
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  : T extends Q3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ? C
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  : D;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type SomeRequired

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type SomeRequired<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • A version of T in which only keys in K are mandatory and the rest are considered optional.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type StatefulPredicate