From 221198b958985cfec918df0b33c3dc6ba70cea22 Mon Sep 17 00:00:00 2001 From: Muhammad Rahmani Date: Sun, 28 Dec 2025 17:42:39 +0330 Subject: [PATCH] Update Object Types.md with interface extension details --- .../copy/en/handbook-v2/Object Types.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/documentation/copy/en/handbook-v2/Object Types.md b/packages/documentation/copy/en/handbook-v2/Object Types.md index d45163830fc8..fb85c3026625 100644 --- a/packages/documentation/copy/en/handbook-v2/Object Types.md +++ b/packages/documentation/copy/en/handbook-v2/Object Types.md @@ -617,8 +617,27 @@ declare const staffer: Staff; staffer.name; // ^? ``` + In this case, Staff would require the name property to be both a string and a number, which results in property being of type `never`. + + +In comparison, extending interfaces with incompatible properties produces a compile-time error: +```ts twoslash +interface Person1 { + name: string; +} + +interface Person2 { + name: number; +} + +interface Staff extends Person1 , Person2 {} +``` +Unlike intersection types, interface extension requires properties with the same name to have compatible types. + + + ## Generic Object Types Let's imagine a `Box` type that can contain any value - `string`s, `number`s, `Giraffe`s, whatever.