I am attempting to extend the Promise object with the following code:
class MyPromise extends Promise {
constructor(executor) {
super((resolve, reject) => {
return executor(resolve, reject);
});
}
}
However, I am getting the following error:

What does this error mean? How can I successfully extend Promise?
Try this...
class MyPromise<T> extends Promise<T> {
constructor(executor: (resolve: any, reject: any) => MyPromise<T>) {
super((resolve, reject) => {
return executor(resolve, reject);
});
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With