TS1062
Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.
When implementing a non-native promise type, if the type references itself in the `then`` method, this error will occur:
declare class BadPromise {
then(
onfulfilled: (value: BadPromise) => any,
onrejected: (error: any) => any,
): BadPromise;
}
async function test() {
await new BadPromise();
}
Fix: Don't use a recursive type.
To fix the error, don't use a recursive type in the definition of the promise.