type Person = {
name: String;
age?: number;
};
// &: Intersection으로 두개이상의 타입을 합침
type Developer = Person & {
skills: string[];
}
const person: Person = {
name: 'dudu'
};
const expert: Developer = {
name: 'duho',
skills: ['js']
};
// Person[]은 People이란 타입으로 사용 가능
type People = Person[];
const People: People = [person, expert];
type Color = 'red' | 'black';
const color: Color = 'red';
const colors: Color[] = ['red', 'black'];