docs(best practices): create section for async functions (#16574)

This commit is contained in:
HonkingGoose 2022-07-15 13:10:01 +02:00 committed by GitHub
parent 6ae4a55bd3
commit badccaff89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,6 +116,11 @@ try {
}
```
### Aysnc functions
Never use `Promise.resolve` in async functions.
Never use `Promise.reject` in async functions, instead throw an `Error` class type.
### Dates and times
Use [`Luxon`](https://www.npmjs.com/package/luxon) to handle dates and times.