퀴즈 · 3 questions
🔎 Narrowing — Compiler 가 너의 `if` 문 읽는 법
typeof, instanceof, in, type predicate, control flow analysis
Level 0Curious
0 XP0/93 lessons0/23 achievements
0/100 XP to next level100 XP to go0% complete
Quiz
01
typeof x === 'string' 이 if 분기 안에서 뭐 해?Hint
if 안팎에서 x hover 해서 narrow 된 타입 봐.02커스텀 type predicate 언제 써?
Hint
function isUser(x: unknown): x is User { return ... } — x is User return type 이 type predicate 로 만드는 거.03Control flow analysis 가 뭐?
Hint
null 에 early-return 하는 함수 쓰고 그 아래 property 접근 — compiler 가 아래에선 non-null 인 거 알아.
댓글 0
🔔 답글 알림 (로그인 필요)로그인 — 댓글을 남기려면 로그인해 주세요.
아직 댓글이 없어요. 첫 댓글을 남겨보세요.