ts-data-forge
    Preparing search index...

    Variable isMutableRecordConst

    isMutableRecord: (u: unknown) => u is MutableRecord<string, unknown> = isRecord

    Type guard that checks if a value is a mutable record (an object with mutable string keys).

    This function is an alias for isRecord, but narrows the type to MutableRecord<string, unknown>, which is useful when you need to ensure that the object can be safely mutated (i.e., its properties can be added or changed).

    Type Narrowing Behavior:

    • Narrows unknown to MutableRecord<string, unknown>
    • Excludes null, undefined, primitives, arrays, and functions
    • Returns true for plain objects with mutable string keys
    • Returns false for arrays and other non-record types

    Implementation: This is a type alias for isRecord.

    Type Declaration

      • (u: unknown): u is MutableRecord<string, unknown>
      • Parameters

        • u: unknown

          The value to check

        Returns u is MutableRecord<string, unknown>

        true if u is a mutable record (plain object with string keys), false otherwise. When true, TypeScript narrows the type to MutableRecord<string, unknown>.

    const obj: unknown = { foo: 1 };

    if (isMutableRecord(obj)) {
    obj['bar'] = 2; // Safe: obj is now known to be a mutable record
    }

    isRecord - For the underlying implementation and more details