type UnwrapPromise = T extends PromiseLike ? U : T; // Example Usage: type StringPromise = Promise; type NumberPromise = Promise; type NonPromise = boolean; type ResolvedString = UnwrapPromise; // string type ResolvedNumberArray = UnwrapPromise; // number[] type ResolvedNonPromise = UnwrapPromise; // boolean async function fetchData(): Promise<{ data: string }> { return { data: 'some data' }; } // Using with ReturnType for async functions: type FetchDataReturnType = ReturnType; // Promise<{ data: string }> type FetchedDataType = UnwrapPromise; // { data: string }