Aliases Type
// #1
type Text = string;
const name: Text = 'ellie';
const address: Text = 'korea';
// #2
type Num = number;
const age: Num = 12;
// #3
type Student = {
name: string;
age: number;
};
const student: Student = {
name: 'ellie',
age: 12,
};
String Literal Types
typs Name = 'name';
let ellieName: Name;
ellieName = 'name'; *// 타입이 Name 타입으로 'name' 만 할당 가능*
type JSON = 'json';
const json: JSON = 'json'; *// 타입이 JSON 타입으로 'json' 만 할당 가능*