퀴즈 · 3 questions
🧙 Generics — TypeScript 가 자기 자신이 되는 곳
Generic 함수, 타입, constraint, default, conditional 타입, infer
Level 0Curious
0 XP0/93 lessons0/23 achievements
0/100 XP to next level100 XP to go0% complete
Quiz
01
function first<T>(arr: T[]): T 가 타입 레벨에서 실제로 뭐 해?Hint
Generic 없이 쓴 같은 함수와 비교 — input 과 output 타입의 link 잃어.
02Generic constraint 에서
T extends U 가 무슨 의미?Hint
function len<T extends { length: number }>(x: T) { return x.length } 쓰고 string, 배열, length 가진 object 로 호출해봐.03Conditional 타입이 뭐?
Hint
type IsString<T> = T extends string ? true : false 쓰고 IsString<'hi'> 와 IsString<42> 가 뭐로 평가되는지 봐.댓글 0
🔔 답글 알림 (로그인 필요)로그인 — 댓글을 남기려면 로그인해 주세요.
아직 댓글이 없어요. 첫 댓글을 남겨보세요.