📎아이템 34 부정확한 타입보다는 미완성 타입을 사용하기
📍 예시
🔗 GeoJSON 형식의 타입 선언(좌표 배열)
interface Point {
type: 'Point';
coordinates: number[];
}
interface LineString {
type: 'LineString';
coordinates: number[][];
}
interface Polygon {
type: 'Polygon';
coordinates: number[][][];
}
type Geometry = Point | LineString | Polygon; // Also several otherstype GeoPosition = [number, number];
interface Point {
type: 'Point';
coordinates: GeoPosition;
}
// Etc.🔗 JSON으로 정의된 Lisp와 비슷한 언어의 타입 선언
📍 정리
📍 요약
Last updated