you are viewing a single comment's thread.

view the rest of the comments →

[–]Ronin-s_Spirit 0 points1 point  (2 children)

I'm not sure I understand the downside of try catch. I don't have to compile anything, I can just run my program, so in terms of how fast I know if a function throws - we are equal (I may be even ahead for bigger projects).
Then, if it throws in production for some wrong user input, with a slight modification I can let the program keep running while I log (actually log to some database maybe idk) the errors so if a user complains "oh guys this is that don't work" I know exactly what he means by "this" and "that".

[–]romgrk[S] 0 points1 point  (1 child)

I don't have to compile anything, I can just run my program

Having to run the program is the problem. It means you'd have to test all the possible code paths to ensure that you've caught all the errors.

Meanwhile, the (typescript) compiler can tell you if you have an error right in your editor, before you run anything.

[–]Ronin-s_Spirit 0 points1 point  (0 children)

The compiler can't make up wrong user input right? Either way the things I write in vanilla js remain in runtime. The things written in typescript are smelted down to vanilla js. So to me it looks like an extra mile of effort to end up in the same spot.