ts-type-forge
    Preparing search index...

    Type Alias ToMutableSet<T>

    ToMutableSet: T extends ReadonlySet<infer V> ? Set<V> : never

    Converts a ReadonlySet<V> type to its mutable counterpart Set<V>. Extracts the value type from the readonly set and creates a standard mutable Set.

    Type Parameters

    • T extends ReadonlySet<any>

      A type that extends ReadonlySet<any>.

    The corresponding mutable Set<V> type.

    type ReadOnlyStringSet = ReadonlySet<string>;
    type MutableStringSet = ToMutableSet<ReadOnlyStringSet>; // Set<string>

    // Converting readonly collections to mutable ones
    const convertToMutable = (readonlySet: ReadonlySet<string>): Set<string> => {
    return new Set(readonlySet);
    };