to complete
to copy from
(?='flat'
) 'deep' to do it deeply
(?=BuiltIn
) types not to merge
(?=never
) types of O
to be replaced with ones of O1
import {O} from 'ts-toolbelt'
type O = {
name?: string
age? : number
zip? : string
pay : {
cvv?: number
}
}
type O1 = {
age : number
zip?: number
city: string
pay : {
cvv : number
ccn?: string
}
}
type test = O.Patch<O, O1, 'deep'>
// {
// name?: string;
// age?: number;
// zip?: string | number;
// pay: {
// cvv?: number;
// ccn?: string;
// };
// city: string;
// }
Complete the fields of
O
with the ones ofO1
. This is a version of Merge that does NOT handle optional fields, it only completes fields ofO
with the ones ofO1
.