JavaScript·Advanced·Coding·1 min read
How do you type a debounce function in TypeScript?
Short interview answer
Make it generic over the original function's parameter tuple, preserve those parameters in the wrapper, and explicitly type cancel or flush methods and return semantics.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.