Today I learned
No floating promises
Unhandled Promises can cause unexpected behavior. For example they can resolve when you don't expext it.
So the best way to deal with Promises is to return them from functions that start them and then handle them.
To enforce this behaviour and prevent unhandled promises, you can use this tslint rule: no-floating-promises Opens in new tab
I find it really helpful and it can reveal a lot of bad code and potential non-determistic behaviour.
If you want to support me, you can buy me a coffee. I would be very happy about it!☕️ Buy me a coffee ☕️
I wish you a wonderful day! Marco