ts-type-forge
    Preparing search index...

    Type Alias MutableRecord<K, T>

    MutableRecord: { [P in K]: T }

    Creates a mutable record type with keys of type K and values of type T. All properties are mutable and can be modified after creation.

    Type Parameters

    • K extends PropertyKey

      The type of keys, must extend PropertyKey (string | number | symbol).

    • T

      The type of values.

    A mutable record type.

    type Config = MutableRecord<string, string | number>;
    const settings: Config = { host: 'localhost', port: 3000 };
    settings['host'] = 'new-host'; // OK
    settings['timeout'] = 5000; // OK