javascript difference between type and interface code example
Example: typescript interface vs type
// for starters:
// interfaces and types are very similar, they just differ in syntax
// interface
interface Car {
name: string;
brand: string;
price: number;
}
// type
type Car = {
name: string;
brand: string;
price: number;
}
// interface
interface Car extends Vehicle {
name: string;
brand: string;
price: number;
}
// type
type Car = Vehicle & {
name: string;
brand: string;
price: number;
}