Answers for "how to get the type of return value of a function in ts"

1

get function return type typescript

type return_type = ReturnType<() => string>; // string
// or
function hello_world(): string {
  return "hello world";
}
type return_type = ReturnType<typeof hello_world>; // string
Posted by: Guest on October-11-2020

Code answers related to "how to get the type of return value of a function in ts"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language