type-challenges / type-challenges

Collection of TypeScript type challenges with online judge

Home Page:https://tsch.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

4 - Pick

kukjun opened this issue · comments

// your answers
// keyof T를 이용해 K는 T의 Keys를 가지도록 함
type MyPick<T, K extends keyof T> = {
  // 타입 매핑 구분
  // K의 key를 반복, 해당 key의 반환타입을 지정 => key: T[key]
  [k in K]: T[k]
}