💡#TypeScript: I used to use the ternary operator when calling a function on an optional property, but now I prefer optional chaining combined with nullish coalescing. Find it more appropriate and readable.
💡#RxJS: I used to merge several observables that emit one value each to an array of values by using the operators concatMap and reduce, but there is a much easier operator for this: forkJoin. forkJoin emits the last value of each observable and completes.
💡#Angular: I implemented a custom error handler that calls a service function to show an alert to the user. I noticed that there is no change detection run after handleError() was called. To fix this, the service function call must be wrapped in NgZone.run().
💡#RxJS: The tap operator has the same signature as the subscribe function, i.e. it takes up to three functions in its parameters, namely next(), error() and complete().
*BUT*: Implementing subscribe's error handler does not rethrow the error, tap's error handler does!