Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 1.86 KB

File metadata and controls

18 lines (13 loc) · 1.86 KB

Get Return Type medium #infer #built-in

by Anthony Fu @antfu

Take the Challenge    简体中文 日本語 한국어 Português (BR)

Implement the built-in ReturnType<T> generic without using it.

For example

const fn = (v: boolean) => {
  if (v)
    return 1
  else
    return 2
}

type a = MyReturnType<typeof fn> // should be "1 | 2"

Back Share your Solutions Check out Solutions