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 ↗
I find it really helpful and it can reveal a lot of bad code and potential non-determistic behaviour.
I hope you enjoyed this post and learned something new. If you have any questions, feel free to reach out to me on Twitter ↗ or via Email ↗.
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