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
 
PREVIOUS NEXT
Tagged: #typescript #promise #return #type
ADD COMMENT
Topic
Name
3+9 =