Post #1095647
2025-06-30 06:35 UTC
Replies (2)
-
@arndissler@hachyderm.io 2025-06-30 08:06
@muhdiekuh@ruhr.social Did you mean catch(e: SomeError) {}? It's a little bit unhandy in comparison to other languages/dialects, that JS/TS does not allow to specify the error type and you need to boil them down on your own (w/ instanceof), but once you find your way to write clean try-catch-blocks it's not a big issue. For larger, collaborative projects, one should define project-wide rule how to handle errors properly, otherwise the code is getting messy as everyone have their own strategy to handle errors what makes it quite hard to catch up after a couple of month'.
-
@rmehner@chaos.social 2025-06-30 08:16
@muhdiekuh@ruhr.social I think this comes down to TS trying to be close to JS as possible, so it can run by simply stripping the types. To support the feature you want, you’d need to generate code. What I’m saying: you’re right, but also yelling at the wrong cloud. AFAIK there’s unfortunately no open ES proposal for this.