DeepFrontend
Learning Paths
Practice
System Design & DS
Design Studio
Data Structures Curriculum
Real-World Case Studies
Careers
Job Board
Resume Builder
Blog
Sign in
Search
⌘K
Go Pro
Loading compiler resources...
TypeScript Quiz Practice
Active Recall Drill Session
← Exit Session
Question 1 of 1
hard
TypeScript
In `function setDefault<T>(value: T, fallback: NoInfer<T>): T`, calling setDefault(5, "not a number") produces what result?
A
It compiles fine, T becomes number | string
B
A compile error — T is locked to number from `value`, and "not a number" (a string) isn't assignable to that locked type
C
It compiles and returns undefined
D
T is inferred as any
Check Answer