Hacker News new | past | comments | ask | show | jobs | submit login

Is TypeScript worth learning? I know that is a loaded question, but I need to ask it anyway.

I am super frustrated with lack of screens for python. I don't want to pigeon hole into an ecosystem where I am limited to a certain platform like Java/Kotlin or even (dare I say) Swift (no real web, still need JS). As a single developer, mostly hobby, I want options for all the things!!!

I have been migrating my Python scraping to JavaScript with node, puppeteer, and it has been quite illuminating, and the speed is ridiculously better. Furthermore, I can easily turn my scrape into a desktop app with electron with an api that is consumed by a mobile app with react-native. Long story short, I can now think about making some of my Python ideas into cross platform desktop apps with mobile versions as well. Not super easy with Python.

The question is would TypeScript be even better for a long term bet?




It's probably best to think of TypeScript as a relatively light JS language extension (like JSX, Flow, or enabling proposed future JS features), not as its own language, even though it's been called a separate language in the past. It's not an alternative to JavaScript, it's a set of guardrails for JavaScript that makes your code safer and hopefully makes you happier when programming. (I'm certainly happier in TS because of all of the editor features it enables, for example.)

If your goal is to grow as a developer, you should absolutely try it out and at least learn the basics. There are valid gripes, like some find it cumbersome for smaller/prototype projects (though I still prefer it over untyped JS even for small things), but it's probably best to try out both worlds (and maybe try out Flow as well) and make an informed choice from experience.


Agreed that it’s pedagogically useful to think of Typescript as a light(ish) extension, hence literture on pure JavaScript will still repay study. But, overall it's best to treat TS as its own language, especially when it comes to developing libraries. This situation isn't dissimilar to Objective-C/Cocoa where the language is a strict superset of C (as in the case of TS and JS), but the real leverage came from framework.


It solves all the issues I have with Javascript, that are all related to its weak and dynamic type system: awkward, unwanted type conversions all around, tons of "undefined is not a function", and lack of IDE integration. So, yes, it's definitely worth it, even for small projects. And it's not like it's hard to learn once you know javascript, anyway. It's nothing more than a superset of the language.


Typescript has been great for me (someone who started with Javascript by writing code essentially through trial and error). One of the other benefits of TS I get surprised a lot less by what the "this" keyword evaluates to.


> that are all related to its weak and dynamic type system

It doesn't make JS strongly typed though. It's still possible to compare different types, it still allows type coercion,truthiness and what not. It add type definitions, but it does not turn Javascript into a strongly typed language.


It actually does disallow various type coercion operations that you can do in JS, even when they're arguably useful. For example `1 == "1"` doesn't typecheck:

https://www.typescriptlang.org/play/index.html#src=const%20x...

So while there are still things like truthy/falsy values, the type system is stronger (not just static) in some sense compared with JS.


TypeScript is a structural typing system, vs the normal nominal one we are used to. Now, I agree that even with this difference, still not a strong typing as it could be, however, get pretty close to it (with all of the added expressiveness added to it). So, all in all, for big app dev, Java vs TypeScript, from a typing point of view, it comes pretty close.


This is true. There are tslint checks that will disallow truthiness in conditionals, and disallow many types of type coercion.


I think using TypeScript with non-nullable types can rid your code-base of undefined errors, without the need of huge test-suites. These are, at least for me, the most frequent type of errors.


I use Python for all of my one-offs and automation scripts still. If I were going to make a large-ish web service on my own, I'd choose Typescript. It's a fantastic middle ground and transpiles to a target that's guaranteed to see constant adoption & incremental performance gains that you'll get 'for free'. If you're looking at Node anyway, definitely consider TS. Low barrier (I just added a loader to my webpack config but there are other ways) and great reward in terms of writing and maintaining code.


Get good at JS and then def. learn TypeScript. It’s incredibly valuable for medium to large projects. It combined with an IDE makes coding JS a lot more manageable.


If you're already using JavaScript for the web, I think there's three main options for that domain:

* stick with JS,

* learn a language that's a superset of JS (like TypeScript), or

* learn another language which compiles to JS.

If you're looking for a language that can also replace Python for you, then maybe the 3rd option above is a good bet. Something which has its own VM (or other native target), but which also can be compiled to JS. For example, Haxe, Kotlin, Nim, Go, or Dart.


I would say definitely yes, good one to learn, and smart bet (and we have avoided lot of hype languages like coffescript, dart, ...).

1. TypeScript is just a modern expressive strutural typing system on top of JavaScript, not a full new language.

2. Modern JavaScript (es2017) is not our old JavaScript, the language matured very well. Not perfect, no language it, but as good as it get for a scripting language, and TypeScript has a lot of structure while keeping its flexiblity.

3. JS/TS really enable a Functional First, OO as needed programming style, which can greatly reduce boilerplate code and API code complexity, which in turn makes the code scale better.

Note: I have been doing Java for the last 20 years, building big enterprise Java app for a living for the last 10 years, and right now, I would say that Modern JS / TypeScript and all of its benefit, offer a better productivity environment for big app development, that traditional Java. We just ported one of our client's Java backend, 40% less code, better typed, and better scale (as most node libs are nio/async in nature)


I don’t think so, and we build JS for enterprise and we were previously/are somewhat a mainly C# house.

Typescript has some advantages that are appealing to people coming from Java/c#, and it integrates sort of well into a codebase that’s a mix of JS and typescript. So you don’t really lose that much from using it. We found it relatively burdensome compared to plain JS, simply put, it made us less productive. You fix some of JSs problems, mainly typesafety, but the trade off is that you’ll need to keep updated on both typescript and JS as well as getting a more complicated approach to prototypes and testing that isn’t as smooth (at least not for us, and that may be us not typescript but it’s still something you have to account for).

If we were doing angular on the front end we might do typescript, but I honestly think we would’ve picked angularDart and flutter instead of typescript.

I don’t think you go wrong either way though, typescript has just been unnecessary for us.


Yeah, we use C# for the backend too and recently moved away from Typescript. It's a breath of fresh air getting away from all of the type complexity of Typescript. Like you said, it just bogged us down and made us less productive.

With VsCode and a jsconfig.json file you can get much of the benefits of typechecking anyway.

I'm still a fan of static typing, but Typescript ain't it. I need something much simpler that isn't dragging our productivity down.


> Is TypeScript worth learning?

It's worth using. like flow it can validate plain js files and even supports a subset of JS doc (on that aspect I wish it didn't, I wish Microsoft established a more powerful format for type comments as an alternative to JS doc which is not well defined, but it does its job). So you don't even have to use ts files. In VSCode IDE, you can just had

    // @ts-check
to benefit from typescript compiler.

At the end of the day, yes, JS today is a safe bet. You can develop native apps with react-native, desktop apps with electron even attempt to include 3rd party language libraries through WASM.

Is it faster than Python? I don't think so, but it's a trade-off. Javascript is ubiquitous now. I say it as someone who still kind of despise the language yet it's productive.


There are at least 4 reasons I can think of that you don't want to write JS without knowing how to use a transpiler, a search will probably find great lists and explanations.. Once you are using one, it makes sense to use typescript and stay close to JS (good for staying close to definitive DOM/BOM guides and debugger results) or an entirely different language that transpiler to JS, for some preferred style. But (once transpiling) there's very few advantages to JS itself over using typescript even with the most occasional use of types for debugging a bad return or variable etc.

The other route to take is to try to follow the cutting edge of webassembly, so you can continue to use a lot of python. Python is probably going to be first in it's class of languages for support at each step, but it's class is not as ideal for webassembly as non-gc strongly typed languages which are ironically less like Python than JS!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: