typescript extend interface override code example
Example 1: typescript override interface property
type Modify<T, R> = Omit<T, keyof R> & R;
interface OriginalInterface {
a: string;
b: boolean;
c: number;
}
type ModifiedType = Modify<OriginalInterface , {
a: number;
b: number;
}>
// ModifiedType = { a: number; b: number; c: number; }
Example 2: typescript extend interface
//declare interface to be extended
interface Vehicle {
brand: string;
plateNumber: number;
}
interface Car extends Vehicle {}