맵드 타입 기반의 유틸리티 타입 1 - Partial, Required, Readonly
Partial
Partial<T>은 특정 객체 타입의 모든 프로퍼티를 선택적 프로퍼티로 변환한다. 즉, 기존 객체 타입에 정의된 프로퍼티들 중 일부분만 사용할 수 있도록 도와주는 타입이다.
예제
간단한 블로그 플랫폼의 일부를 직접 구현한다고 가정해보자.
// 게시글 타입
interface Post {
title: string;
tags: string[];
content: string;
thumbnailURL?: string;
}
...
woodstock.hashnode.dev3 min read