from Hacker News

TypeScript 4.0 Beta

by DanRosenwasser on 6/26/20, 5:01 PM with 17 comments

  • by eloff on 6/26/20, 5:49 PM

    Looks like some improvements to spread operators and tuples, which is welcome.

    I'm most excited about: TypeScript 4.0 supports a promising proposal to add three new assignment operators: &&=, ||=, and ??=.

    Which is a nice shortcut for operators I use often.

    No huge changes here that I can see, just small steady improvements to an already excellent language.

  • by nammi on 6/26/20, 5:59 PM

    I'm a bit paranoid about upgrading after breaking changes in 3.9 removed the ability to stub ES imports with Sinon/Jasmine/etc..., since the section of the release notes made it sound pretty innocuous: "Getters/Setters are No Longer Enumerable".

    https://github.com/microsoft/TypeScript/issues/38568 https://github.com/microsoft/TypeScript/pull/32264

  • by mpawelski on 6/26/20, 9:54 PM

    This release will be great. Lots of people were waiting for variadic tuple types.

    I love when such "old" feature request is finally added to Typescript. First proposal for it was almost 5 years ago [1]. It really gives hope for other long standing and heavily upvoded feature requests that maybe we'll get them one day :)

    [1]https://github.com/microsoft/TypeScript/issues/5453

  • by tengbretson on 6/26/20, 6:25 PM

    So excited for variadic tuple types. This will be an absolute game changer!
  • by seph-reed on 6/26/20, 6:29 PM

    > Properties Overriding Accessors (and vice versa) is an Error

    Not sure I like this. Can definitely imagine the following being a realistic scenario, and see no reason to disallow it:

        class Base {
          public num = 42;
        }
    
        class Child extends Base {
          protected _num = 42;
          // no longer allowed in 4.0
          public get num() { return this._num; }
          public set num(newVal) { 
            alert(`new num ${newVal}`);
            this._num = newVal
          }
        }
    
    Did I misunderstand something?
  • by nojvek on 6/26/20, 6:39 PM

    —incremental with —noEmit is kind of a big deal. Really cool.

    We use ts-loader with webpack in transpileOnly mode and a separate tsc invocation for typechecking that runs as a linter i.e noEmit

  • by jondubois on 6/26/20, 7:07 PM

    I like TypeScript because it gives me an edge over my competitors. I look forward to Microsoft coming up with more abstractions to further constrain and slow down my competition and keep lowering the productivity bar in my industry - Microsoft was right when they said that TypeScript would make my life easier.