forked from type-challenges/type-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
7 - Readonly #2
Copy link
Copy link
Open
Labels
answerShare answers/solutions to a questionShare answers/solutions to a question
Metadata
Metadata
Assignees
Labels
answerShare answers/solutions to a questionShare answers/solutions to a question
keyof는 주어진 객체 타입에서 모든 키를 Union 타입으로 변환합니다.
예를 들어, userInfo라는 인터페이스가 있을 때:
위 코드에서 keyof userInfo는 userInfo 인터페이스의 모든 키를 union 타입으로 반환합니다. 즉, keyofValue는 "name" | "age"가 됩니다. 이는 userInfo 객체에서 name과 age라는 키를 선택할 수 있다는 의미입니다.