Returns a new type consisting of all properties declared for an input type T2 overlaid on the
properties of type T1. Any definitions in T2 replace those previously defined in T1. This can
be useful for redefining the types of properties on T1 with values from an inline type T2, perhaps to
change their type or to make them optional.
typeNameAndStringValue = { name: string, value: string } typeNameAndOptionalNumericValue = Overwrite<NameAndValue, { value?: number }> // type of NameAndOptionalNumericValue -> { name: string } & { value?: number | undefined }
Returns a new type consisting of all properties declared for an input type
T2
overlaid on the properties of typeT1
. Any definitions inT2
replace those previously defined inT1
. This can be useful for redefining the types of properties onT1
with values from an inline typeT2
, perhaps to change their type or to make them optional.