Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I tried TypeScript yesterday and while I really love the language, the tooling was wayyyy too complicated and confusing. All I wanted was to make a dead simple hello-world node app that let me write it in VS Code, and recompile the TS to JS every time I saved. Suddenly I had to learn about tsconfig.json, had to install nodemon and have a process running in the background that I'm sure to forget to kill later, and I have no idea how either tsc or ts-node plays into any of this... in the end I just decided to go with ES2016 and be done with it. Too bad, because I really like having type information available, especially for catching bugs. I enabled VS's "pretend JS is TS" setting so it catches some errors, but it's pretty hacky and not thorough, and I don't get to specify types in my program. Really wish I could get a dead simple TS app figured out.


1) tsc --init # creates a tsconfig.json, no need to edit it

2) tsc --watch # rebuilds every .ts file on save

There is no step 3.


Hey this is pretty great, thanks! Dunno why I didn't consider it to be that simple. But it really is working. Well, along with `npm install @types/node --save` which I found somewhere else, so it quits complaining about 'require' not being found.


Glad it worked! I think it's a failure by the TypeScript team to not make this flow more front and center.

You are right, I forgot about installing typings. Instead of require you should use ES6 "import" (which TS compiles to require anyway) to get more type checking. But when you do that you'll see more of my missed step, which is `npm install @types/XYZ` for each XYZ package you use.

As soon as you start introducing a separate build tool (like gulp or whatever) things get super messy super fast but not for any interesting reason. Using `tsc --watch` also means it does caching across builds so it's faster than using gulp unless you're careful to configure it.


This advice is gold, thanks. But what I'm finding is that it's too painful to create a TypeScript project that has both a front-end and a back-end by incrementally building it like this, unless the front-end is just a set of static files with no compilation steps.


> 1) tsc --init # creates a tsconfig.json, no need to edit it

hm... i reckon that if one doesn't need to edit a 'default' config file, perhaps the file doesn't really need to exist.


Will this be fixed when a "canonical" docker container comes out for it? Or perhaps two containers - 1 for dev & dev dependencies and 1 for "prod"?


You could always just opt for a typed language.


Which typed language do you prefer to run in browsers?


The comment I was replying to was referring to Node, so based on the context I wasn't discussing the browser.


On that note, I wonder if we'll ever see type="text/typescript" in the browser due to how much traction it's gaining so quickly, and considering it's basically always ESNext but with types.


Not likely. WebAssembly is the path to expanding language support in the browser now.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: