TypeScript 배우기 - 8. keyof 타입 연산자
오늘은 TypeScript의 keyof 타입 연산자에 대해 알아볼 것입니다. 어렵지 않으므로 빠르게 이해해 봅시다!
// 객체 타입 Point 생성
type Point = { x: number, y: number };
// Point의 속성에 의해 "x" | "y" 문자열 리터럴 타입이 됨
type P = keyof Point;
const a:P = "x";
const b:P = "y";
const c:P = "m";
> ...
dimohy.slogs.dev1 min read