type User = { id: number; name: string; email?: string; // Optional property marked with '?' }; const newUser: User = { id: 1, name: "Alice" }; Use code with caution. Interfaces
The type keyword allows you to create custom names for complex types, making your code cleaner. typescript typescript
Generics allow you to create reusable components that work with a variety of types rather than a single one. TypeScript TypeScript: Documentation - Generics type User = { id: number; name: string; email