lib.es5.d.ts
interface Promise<T> {
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
}
상당히 복잡하지만, 한 가지 분명한 것은 then 메서드를 가지고 있다는 것입니다. 따라서 Promise 객체는 object & { then(onfulfilled: infer F, ...args: infer _): any를 extends합니다.
type Result<T>
= Promise<T> extends { then(onfulfilled: infer F, ...args: infer _): any }
? true : false;
// type Result<T> = true