Type alias ReplaceType<Type, Keys, NewType>

ReplaceType<Type, Keys, NewType>: ReadOnly<Omit<Type, Keys>> & ReadOnlyRecord<Keys, NewType>

Intersection that replaces the type of some keys in given object type.


Intersection type to replace all the given keys of an object type with a new type.


type User = { name: string; age: number };
type ReallyOldUser = ReplaceType<User, "age", bigint>;


Type Parameters

  • Type extends object

    Type to replace the type of some keys in.

  • Keys extends keyof Type

    Keys to replace the type of.

  • NewType

    New type to replace the old type with.