DEV Community

loading...

πŸ’‘πŸ€” Early Thoughts on TypeScript

scottw profile image Scott Watermasysk Originally published at scottw.com on ・1 min read

I have not written enough TypeScript to know if I love it, hate it, or am just indifferent. In building my first small project, I found myself fumbling around the types and syntax quite a bit.

However, in just about every case, where I compiler complained about lack of type or an invalid type it saved me from code that likely would not have worked. Even better, the speed at which you receive the feedback is impressive.

Discussion (4)

pic
Editor guide
Collapse
quintisimo profile image
Quintus Cardozo

The way I like to do it is to get the code working with inferred types and then slowly start adding type declarations to inferred any to fixing any errors that show up.

Typescript is also good if your working with API. You can convert a JSON response to a interface using a website or vscode plugin and then have full typing for the API in you editor

Collapse
itsjzt profile image
Saurabh Sharma

When I started doing typescript I did everything as any when it throws error and when I didn't know the proper types (such as for react event handler types).

So I would just add that it OK to skip the type system in the beginning stage.

Collapse
dbanty profile image
Dylan Anthony

I’m really not a fan of JavaScript, it’s a bit too wishy washy and I always get annoyed trying to debug it. TypeScript is like a whole different world though.

Yeah the syntax is a bit clunky and the documentation could use a lot of work, but I actually enjoy writing it. To the point where I, for the first time, tried following some NodeJS tutorials which use TypeScript. None of them worked right for one reason or another so if anyone has a recommended one please link it! I’ve only written services in Python and want to branch out.