Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Uncaught TypeError: Promise.reject is not a constructor

I had a problem;

const p4 = new Promise.reject("Error"); 

or

const p4 = new Promise.resolve("Sucess"); 

I get such an error when defining;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Uncaught TypeError: Promise.reject is not a constructor

There shouldn’t be any errors.

>Solution :

Here is how you can fix the error. The issue is with the new keyword.

Promise.reject is a static methods rejects Promises directly so you should not use the new keyword with them.

here is documentation of Promises

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading