<aside> 📌 타입을 부여하는 타이핑 (Typing) 예시들

</aside>

변수에 타입 붙이기

const str: string = 'hello';
const num: number = 123;
const bool: boolean = true;

const n: null = null;
const u: undefined = undefined;

const sym: symbol = Symbol('sym');
const big: bigint = 100000000n;
const obj: object = { hello: 'world' };

함수에 타입 붙이기

// 함수 선언식
function plus(x: number, y: number): number {
	return x + y;
}
// 화살표 함수
const minus = (x: number, y: number): number => x - y;