获取函数返回类型 中等 #infer #built-in

by Anthony Fu @antfu

接受挑战    English 日本語 한국어 Português (BR)

不使用 `ReturnType` 实现 TypeScript 的 `ReturnType` 泛型。 例如: ```ts const fn = (v: boolean) => { if (v) return 1 else return 2 } type a = MyReturnType // 应推导出 "1 | 2" ```
返回首页 分享你的解答 查看解答