- Error
- Reported by the type checker
TS2430
Interface '{0}' incorrectly extends interface '{1}'.
An interface extends another but redeclares a member with an incompatible type. Make the member's type assignable to the base interface's.
What it means
An interface that extends another must stay assignable to it. Redeclaring an inherited property with a type that doesn't fit the base property's type is reported on the interface name.
Example
interface Entity {
id: string;
}
export interface Order extends Entity {
id: number;
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(4,18): error TS2430: Interface 'Order' incorrectly extends interface 'Entity'.
Types of property 'id' are incompatible.
Type 'number' is not assignable to type 'string'.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Use a type for the member that is assignable to the base one (the same type, or a narrower one).
- If the member needs a different type, use
Omit<Entity, "id">as the base, or rename the member.