Back to Cheatsheets
TypeScript

Interfaces & Types

Object shapes and type aliases

Interface Features

4 items
CommandDescription
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

Utility Types

6 items
CommandDescription
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