devtypes - v2.2.0
    Preparing search index...

    Type Alias ReplaceMany<T, R>

    ReplaceMany: { [K in keyof T]: K extends keyof R ? R[K] : T[K] }

    Replace the type of one or more keys in an existing type.

    Type Parameters

    • T

      The original object type

    • R extends Partial<Record<keyof T, any>>

      A mapping of keys to their new types

    Creates a new type by substituting specified keys with new types. Useful for modifying specific properties without affecting the entire structure.

    type User = { id: number; name: string; email: string };
    type UpdatedUser = ReplaceMany< User, { name: number; email: boolean } >;
    // { id: number; name: number; email: boolean }