Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why TypeScript Doesnt Have Typed nor Checked Exceptions (github.com/microsoft)
2 points by nonethewiser on Aug 9, 2023 | hide | past | favorite | 1 comment


I found this very informative. I found myself thinking about returning errors instead of throwing them to ensure they are accounted for (in the context of a simple rest api with controller/service pattern). I thought it would be nice if you could instead throw errors and have a function type signature that reflects that. I don't come from Java but understand this is a feature there.

The tl;dr is: Javascript wasn't built for this. [Insert snarky comment about that not stopping developers before]




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: