← Back to context

Comment by yanis_t

3 years ago

Many people fail to see that the real benefit of using TypeScript is better tooling (code completion, intenseness, refactoring capabilities, self-documenting code) and not the mere ability to catch some stupid runtime errors at compile time.

All of those (apart from intenseness hehe) are consequences of using a decent type system. I don’t think people ignore that IME.

Just yesterday I ran into a runtime error when I forgot the round brackets in`Buffer .contact`. This wouldn't have happened with Typescript.

  • For a moment was intrigued what contact would do on a buffer but I think you meant concat.

This is one of the reasons I find it hard to like TypeScript. Despite proclamations about reducing errors and maintainability, I have seen many developers largely motivated to introduce TypeScript for no reason other than the ability to hit "." and see what comes next. While that is a good goal, transmogrifying a type system (and a rather weak one at that) into an IntelliSense annotation mechanism seems excessive.

  • It's comments like this that make me feel better about my own decisions.

    Because if that was the only benefit typescript had, it would be a win. I mean that was the whole point with JSDOC.

    Anything that shortens the feedback loop from writing the code to seeing if it works is a win.

    This is the equivalent of saying, "I see many people switching jobs for no reason other than to make more money". Like... That's the not the only reason but it's a big one.

    Then you get into algebraic data types, and encoding logic constraints into the type system, and you can make entire classes of bugs impossible to write.

    Type systems are about safety and productivity.

  • Do you have an alternative suggestion? Because the ability to type "." and see what comes next, go-to-definition, find all references, rename symbol, etc. are all enormous time savers.

    Just as yanis_t said, they're easily worth it even if you ignore the significant bug reduction (approximately 15%).

    I don't know of any other way to get that kind of productivity boost. What would you suggest instead?

  • Why do you think the type system is weak? I was using PureScript (Haskell derivative) prior to TypeScript, and I have found its typing capabilities to be very impressive.

    • I think maybe by "weak", the GC is referring to how the guarantees of TypeScript are not very "strong", i.e. TypeScript is not a "sound" type system.

      1 reply →