Skip to content

Latest commit

 

History

History

00002-medium-return-type

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Get Return Type medium #infer #built-in

by Anthony Fu @antfu

Take the Challenge    简体中文 日本語 한국어

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