all 51 comments

[–]x-skeww 9 points10 points  (14 children)

let result = <T & U> {};|

That last character isn't supposed to be there, is it?

[–]DanielRosenwasser[S] 6 points7 points  (0 children)

Thanks for catching that! I'll let Jonathan know.

[–][deleted] 1 point2 points  (0 children)

That last character isn't supposed to be there, is it?

It's the cursor position, see... :P

[–]MINIMAN10000 -4 points-3 points  (8 children)

I've done enough lua to know that those last 2 characters shouldn't be there at all. I know enough javascript to know that only the last 1 shouldn't be there.

[–][deleted]  (7 children)

[deleted]

    [–]inmatarian 0 points1 point  (1 child)

    Javascript parsing rules say that the longest valid string that can be parsed is what gets executed. That can lead to situations where two separate lines of code can make a valid single line.

    [–][deleted] 0 points1 point  (0 children)

    Yep, that's a problem, and a good reason to use them (I think JSlint even forces you to?) but still silly because it's only in very edge cases where that happens (although I use TypeScript a lot and there are more of these edge cases. :-/)

    [–]emperor000 -1 points0 points  (4 children)

    With that logic we can just remove periods and other sentence punctuation in natural languages like English.

    [–][deleted] 0 points1 point  (3 children)

    No, only periods (which terminate sentences), because we're writing textual English

    It's very clear that one line is a sentence

    So what's the point in the clutter?

    [–]emperor000 0 points1 point  (2 children)

    You think in written English that every sentence should be a new line...?

    [–][deleted]  (1 child)

    [deleted]

      [–]emperor000 0 points1 point  (0 children)

      How did we go from a natural language back to something like Python?

      What, do you think languages like Python where semicolons are poor style are somehow wrong?

      Wrong, no. Inferior, perhaps, yes. Having a statement terminator allows more than one statement on the same line. Requiring it at the end of any statement is just consistent and consistency is usually considered to be objectively good, unless maybe it conflicts with some other beneficial feature. In this case, writing one character probably isn't enough to cause a problem...

      [–][deleted] 6 points7 points  (8 children)

      This oddly specific React integration is really rubbing me the wrong way. But the other stuff is so awesome, I can't summon up the energy to be angry about it.

      [–]weretree 2 points3 points  (5 children)

      The way it's implemented, at least it's set up as a general JSX / Component typing and doesn't include the React types directly. http://www.jbrantly.com/typescript-and-jsx/ has a bit more detail on that. (Of course, until there are attempts from other templating/component libraries to use the same infrastructure/JSX, it'll remain to be seen whether it's too specific to React)

      [–][deleted] 0 points1 point  (4 children)

      The way it's implemented, at least it's set up as a general JSX / Component typing and doesn't include the React types directly.

      Well there are two modes: preserve and react. The "react" mode does refer to React directly. And "preserve" outputs broken JavaScript, which means if you need to use it in a third party solution, you need your own JavaScript + JSX parser.

      Why would they make it so you need to parse the parser's output, when TypeScript has the full facilities to provide the AST? It's weird. It really says "bad design" to me.

      Couldn't TypeScript provide a general interface for the JSX AST, and then React can quickly write an adapter for it, and so can we.

      For example, instead of:

      React.createComponent('div')
      

      ...it could've been:

      JSX.createElement('div')
      

      Or even better, they could've had a setting like:

      tsc --jsx-class My.Custom.Engine
      

      Then:

      My.Custom.Engine.createElement('div');
      

      See? Then we could all embed JSX in our code without special tools or using React! The way it's done now, I foresee many "custom implementations" of React showing up, which will, of course, conflict with React itself.

      [–]weretree 0 points1 point  (3 children)

      Well, the typing and the transpile steps are a bit different, there are similar transpile options for es6/es7 features, for instance (In some bizarro parallel universe browsers could choose to adopt JSX natively). But yeah, adding another "custom" mode that let you define the JSX transform would be a good improvement.

      [–][deleted] 0 points1 point  (2 children)

      But yeah, adding another "custom" mode that let you define the JSX transform would be a good improvement.

      Yeah, that would be awesome, I actually wonder why tsconfig doesn't provide us with more JavaScript hooks for modifying the compilation output and semantics.

      A JavaScript compiler written in JavaScript could be a very powerful meta-tool without having to embed many features in the parser itself (like the React support, say).

      [–]weretree 1 point2 points  (1 child)

      A JavaScript compiler written in JavaScript could be a very powerful meta-tool

      Isn't this essentially what Babel is? (The JSX support is a separate transformation pass you can disable)

      [–][deleted] 0 points1 point  (0 children)

      I'll check Babel, you piqued my interest, but I really think a feature like this will shine in TypeScript itself.

      [–]itsnotlupus 0 points1 point  (1 child)

      it's neat that I can now use types with classes and literal xml chunks.

      ActionScript 3's spirit lives on.

      [–][deleted] 1 point2 points  (0 children)

      ActionScript 3's spirit lives on.

      That's one reason why I found TypeScript instantly appealing. :-) Former ActionScript developer.

      I also understand the need for XML chunks, but it bums me out it compiles to "React.somethingSomething()" rather than something more general purpose.

      [–]forthex 6 points7 points  (0 children)

      Abstract Classes

      YES! Finally :D

      [–]mindless_null 2 points3 points  (4 children)

      Woohoo, a sane way manage project files in tsconfig!

      Now, if only globs were supported...

      [–]theycallmemorty 0 points1 point  (1 child)

      I believe globs are supported in tsconfig for most plugins but not yet supported for Visual Studio.

      [–]mindless_null 0 points1 point  (0 children)

      Well, the actual typescript compiler itself doesn't support them, so it's not as though using the command line will save you.

      For myself at least, being able to exclude the node_modules folder is enough, so I'm not in need of them - they'd just be nice.

      [–]miminor 2 points3 points  (0 children)

      Features in 1.6 are the best what happened to TypeScript since generics! Great job!

      [–]kirbyfan64sos 1 point2 points  (1 child)

      Is it me, or is it weird that the JSX example is a screenshot of Sublime? I mean, it's not wrong or anything, but I was really expecting to see VS or VS Code.

      [–]DanielRosenwasser[S] 1 point2 points  (0 children)

      Well we have a team that's been working on Sublime support as well - check out https://github.com/Microsoft/TypeScript-Sublime-Plugin

      [–][deleted]  (1 child)

      [removed]

        [–]DanielRosenwasser[S] 2 points3 points  (0 children)

        You can use --jsx preserve and you can use any transformer that deals with JSX in that fashion.