Hacker News new | ask | show | jobs
by ggregoire 3079 days ago
Most JS developers have no or few experience with strongly typed languages. I think it's a thing you need to try by yourself to see the benefits. I was kind of an anti-TS some years ago ("it's too verbose, it's not JavaScript"), but since I used Flow for 1 year I now see the obvious benefits (my favorite being to have autocompletion for almost anything, and not having to wait the runtime to see that `user.fisrtname` is undefined).

Also, probably some React developers would like to use TS/Flow and their manager says 'nope'.

1 comments

I’m a heavy TS user, but the compilation step is a PITA compared to working with bare JavaScript. Sometimes I forget to build and I wonder why my program hasn’t changed.

I wish browsers would suck in TS directly. It doesn’t require much translation to get the corresponding JS files, just ignoring some types and that’s it.

Against watch scripts for any reason?

It's pretty simple to get TS building via webpack for react, and tsc itself has a watch mode. The only PITA there is if you save any breaking changes, the build will obviously fail until you've completed and saved any the working changes, but at least you can't forget.

I seem to forget to save sometimes also (granted, that would mess me up with javascript also), I'm just so used to straight C# in Visual studio!

Typescript also isn't a very fast compiler, it doesn't seem to be incremental or retained at all, so when you build your project, it take a few seconds when your project has grown beyond a certain size. Sometimes I build and then hit run too early (before the build is actually finished).

Ah yeah. I guess Webpack's boost would be lost if your project ends up at all complex as well.

Are you doing all of your TS dev in Visual Studio as well?

I'm using webpack on a ~60 TS files project now. It takes a few seconds to bootstrap, but then, in watch mode, it only compiles the files that are changed and it's really fast.
No, since leaving Microsoft I've been doing everything on a Mac via VS Code.