📎아이템 33 string 타입보다 더 구체적인 타입 사용하기
📍 예시
🔗 음악 컬렉션을 위한 앨범 타입 정의
interface Album {
artist: string;
title: string;
releaseDate: string; // YYYY-MM-DD
recordingType: string; // E.g., "live" or "studio"
}const kindOfBlue: Album = {
artist: 'Miles Davis',
title: 'Kind of Blue',
releaseDate: 'August 17th, 1959', // Oops! // 날짜 형식 다름
recordingType: 'Studio', // Oops! // live or studio
}; // OK⭐️ 이러한 방식의 세 가지 장점

📍 정리
📍 요약
Last updated