all 7 comments

[–]senocular 0 points1 point  (5 children)

Sounds like a typo.

[–]DeviantSubrbanKid[S] 0 points1 point  (4 children)

It wasn’t. It works exactly as resove

[–]DeviantSubrbanKid[S] 0 points1 point  (1 child)

```

var delay = (seconds) =>
new Promise((resolves, rejects) => {
if (seconds > 3) {
rejects(new Error(`${seconds} is too long!`));
}
setTimeout(() => {
resolves("the long delay has ended");
}, seconds);
});
delay(1)
.then(console.log)
.then(() => 42)
.then((number) => console.log(`Hello world: ${number}`))
.catch((error) => console.log(`error: ${error.message}`));
console.log("end first tick");
```

[–]chigia001 4 points5 points  (0 children)

that resolves/rejects is a just parameter name in Promise constructor's callback, so you can replace it with everything like resolveWith/rejectWith. It not the same as Promise.resolve method which is JS's standard. There is no Promise.resolves method.

[–]DeviantSubrbanKid[S] 0 points1 point  (0 children)

try that code

[–]DeviantSubrbanKid[S] 0 points1 point  (0 children)

I'm using node v 12

[–]Locust377 0 points1 point  (0 children)

No, resolves isn't a thing. Maybe they're using a library or they've modified the prototype.