Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 1.96 KB

File metadata and controls

18 lines (13 loc) · 1.96 KB

Get Return Type 보통 #infer #built-in

by Anthony Fu @antfu

도전하기    English 简体中文 日本語 Português (BR)

내장 제네릭 ReturnType<T>을 이를 사용하지 않고 구현하세요.

예시:

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

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

돌아가기 정답 공유하기 정답 보기