Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript extend interface remove property

interface Person {
  name: string;
  age: number;
  address: string;
}

// ✅ Remove 'age' property from interface
type WithoutAge = Omit<Person, 'age'>;

// ✅ Remove multiple properties from interface
type WithoutAgeAndAddress = Omit<Person, 'age' | 'address'>;

// ✅ Remove property and extend interface
interface PersonWithoutAge extends Omit<Person, 'age'> {
  language: string;
}
Source by bobbyhadz.com #
 
PREVIOUS NEXT
Tagged: #typescript #extend #interface #remove #property
ADD COMMENT
Topic
Name
8+8 =