TypeScript Type Aliases
Use type aliases to create reusable custom types and combine them with unions and intersections.
David Miller
Dec 23, 2025
8,552205
Type aliases give names to complex types.
## Basic
```ts
type ID = number | string;
let userId: ID = 101;
```
## Object alias
```ts
type User = {
id: ID;
name: string;
};
```
## Intersection
```ts
type A = { a: number };
type B = { b: number };
type C = A & B;
let obj: C = { a: 1, b: 2 };
```
## Type vs Interface
- Type: unions, primitives
- Interface: object shapes, extension
## Remember
- Use type for flexibility
- Combine with unions/intersections
#TypeScript#Beginner#Types