TypeScript·Advanced·Conceptual·1 min read
How does ReturnType<typeof fn> help avoid duplicated type definitions?
Short interview answer
It extracts a function's return type directly from its implementation, so if the function's return shape changes, dependent types update automatically instead of needing a parallel manual type declaration.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.