Object shapes and type aliases
| Command | Description |
|---|---|
interface User { name: string; age?: number; } | Optional property (?) |
readonly id: string | Cannot modify after creation |
[key: string]: any | Index signature (dynamic keys) |
interface Admin extends User { role: string } | Inheritance |
| Command | Description |
|---|---|
Partial<Type> | Make all props optional |
Required<Type> | Make all props required |
Readonly<Type> | Make all props readonly |
Pick<Type, "id" | "name"> | Select specific props |
Omit<Type, "password"> | Remove specific props |
Record<string, number> | Object with specific key/value types |