Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript get the promise return type

type AsyncReturnType<T extends (...args: any) => any> =
	T extends (...args: any) => Promise<infer U> ? U :
	T extends (...args: any) => infer U ? U :
	any
Source by blog.bitsrc.io #
 
PREVIOUS NEXT
Tagged: #typescript #promise #return #type
ADD COMMENT
Topic
Name
4+7 =