Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/documentation/copy/en/handbook-v2/Object Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down