I got return type from method but need the type of the generic of that type.
I use method getDocument which return interface PDFPromise<T> and I need type of that T which is PDFDocumentProxy. I try:
type MyPDFPromise = ReturnType<typeof getDocument>; //get the PDFPromise<PDFDocumentProxy>
type MyPDFDocumentProxy = MyPDFPromise extends Promise<infer U> ? U : undefined;
But of course the PDFPromise don’t extend the Promise, I try with Object but with no luck. How could I get the type PDFDocumentProxy from that generic?
Thanks