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.

    This function has the same runtime behavior as isRecord (non-null, non-array object check), but narrows the type to MutableRecord<string, unknown>, which is useful when you need to add or overwrite properties on the narrowed object.

    Type Narrowing Behavior:

    • Narrows unknown to MutableRecord<string, unknown>
    • Excludes null, undefined, primitives, functions, and arrays
    • Returns true for every other non-null object (see isRecord for details on non-plain objects such as Date, Map, and Set)

    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 non-null, non-array object, false otherwise. When true, TypeScript narrows the type to MutableRecord<string, unknown>.

    const obj: unknown = { foo: 1 } as const;

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

    isRecord - For the underlying implementation and more details