2 - Get Return Type
Author: VarunMendreCreated Sep 14, 2026Updated Sep 14, 2026
Labelsanswer2en
// make sure typed para T is extending Function so we could infer the return type
type MyReturnType<T extends Function> = T extends (...args: any) => infer R ? R : never;
Source: type-challenges/type-challenges