from Hacker News

Announcing TypeScript 3.1

by DanRosenwasser on 9/27/18, 3:00 PM with 62 comments

  • by monkmartinez on 9/27/18, 5:09 PM

    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?

  • by the_other_guy on 9/27/18, 5:05 PM

    For me, Javascript now means Typescript, thanks to all who contribute to this great language!
  • by erokar on 9/27/18, 5:41 PM

    TypeScript is fine. I used it for about half a year when wokring on an Angular app. But for new projects with React now I seldom see the need to include it.

    Sure, TS gives you a little bit better autocompletion in VS Code, you can document your function signatures a little bit better and you can catch a few trivial type errors — but it also has some costs: Extra set up, extra build steps, the need to also import type definitions when including a library, cluttering the code with interfaces and type definitions.

    I find the extra value it gives over PropTypes in React is pretty low. And while types in function signatures arguably increase understanding, elaborate interface definitions, sometimes in their owen files with the need to import them, can clutter up the code and be a detriment to readability. Also, VS Code's auto completion is very good even without TS.

  • by theodorejb on 9/27/18, 4:21 PM

    Seems like a pretty small release in comparison to previous updates. Probably a good thing, though - it demonstrates that the language as reached a very mature state with few remaining gaps.
  • by tlarkworthy on 9/27/18, 6:48 PM

    I love Typescript and the type system is getting pretty powerful. I would like to use it more in commandline utilities, but then I find the JS event loop makes sequential commands annoying, or REPLs need trampolining etc.

    There is nothing in typescript that actually ties the type system to the event loop. I would love the Typescript language applied to a runtime that was ok with blocking IO.

  • by yawgmoth on 9/27/18, 5:38 PM

    What is the lowest ceremony way to start building a TypeScript SPA? I would love to avoid Webpack if I can :)
  • by dlbucci on 9/27/18, 6:12 PM

    Glad to see that adding properties to functions will be easier now. I've been tripped up by that a few times before, and was always surprised at how painful it was to type such a relative common JS pattern.
  • by velox_io on 9/27/18, 5:40 PM

    I was kind of hoping that they would get rid of null or undefined (or both). While I understand that null and undefined are not the same, are both truly needed? Seems like a missed opportunity to make the language cleaner. They seem redundant when you have exception handling, which I think makes the flow of the code easier see.

    Could they be removed?

  • by ZeikJT on 9/28/18, 2:44 PM

    Another case of just blatantly ignoring semver[0] and only increasing the minor version while including backwards incompatible changes!

    [0] https://semver.org/

  • by novaleaf on 9/27/18, 8:44 PM

    self plug: i wrote a "corelib" for typescript: https://www.npmjs.com/package/xlib

    right now it's only meant for nodejs use (it's too big for browsers) but I use it successfully in my production code, and have been using it for years, so it's got that for it :)

    i plan to add proper browser support (minification, tree shaking, etc) when i do my next client side project, but that's still at least a few months off.

  • by crudbug on 9/27/18, 6:05 PM

    Can we have a CLR backend now ?