Limitations and Edge Cases
You'll learn: where TypeScript's function-related utility types (ReturnType, Parameters, ConstructorParameters) break down or behave unexpectedly.
The Core Idea
While utilities like ReturnType<T> and Parameters<T> work beautifully for straightforward functions, they have blind spots. Overloaded functions, non-function types, and never types expose situations where these utilities either produce surprising results or fail to capture the full picture you might expect.
Overloaded Functions
When a function has multiple overload signatures, ReturnType and Parameters extract types from the last signature (the implementation signature), not the public overloads you actually call. This means the extracted type might not match what you expect from the function's public API.
Non-Function Types
Passing a non-function type to ReturnType<T> or Parameters<T> causes a compile error. These utilities require T extends (...args: any) => any. Accidentally passing a string, object, or any will break your code.
The never Type
If you pass never to these utilities, you get never back. While technically correct (there are no instances of never), this can propagate through your code in unexpected ways, especially in conditional types or mapped types that rely on function extraction.
Why This Matters
Understanding these limitations prevents surprises when using these utilities in complex generic code, library typing, or factory patterns where function shapes vary.
Key Takeaway:
ReturnType, Parameters, and ConstructorParameters work on the last signature of overloaded functions, reject non-function types, and propagate never silently—know these boundaries to avoid subtle bugs.