1. 21

  2. 5

    I am so disappointed. Sure, the type inference is incredibly well fleshed-out, but outside of that, there’s no power to the type system, and it becomes yet-another layer of compilation for JavaScript. If you wanted a type checker you’d already be using TypeScript and if you wanted a powerful and expressive type system then you would either deal with normal JavaScript and pseudo-types or you would move on and use a language like Haste or PureScript.

    I was really hoping for Haskell-level type inference with HM stuff, which could be annotated through comments. So I guess it’s time to start that side project of mine…

    1. 2

      For all the people disappointed with the expressivity of the type system, I present dependently typed javascript. There’s an implementation out of Berkeley somewhere but I’m too lazy to dig it up.

      1. 1

        I wonder this would work with things like Traceur.

        Not sure this thing works on ECMAScript 6, and the generated code by the compiler doesn’t contain type annotations, so I don’t immediately see a way to insert it in the compilation toolchain of non-plain JS projects.

        Not that it detracts from the value this tool could offer stand-alone.

        I would love some kind of offline type checking for my JS code, but I also really enjoy using ES6 modules today, and I’m not sure I would give that up in order to gain static type checking.

        1. 2

          If you’re using Traceur, you might want to play around with the AtScript options. https://github.com/google/traceur-compiler/issues/1430

          1. 1

            I have the same questions. I’m quickly getting to the point where I need a pipelining compiler, something that can take a source file and push it through (theoretically) Flow -> JSX -> Traceur. You have to move through JSX to remove the type annotations. JSX is aware of many ES6 features, but I don’t know about all of them. If you wanted to add Sweet.js into the pipeline I think you would be hosed.

            I still write a lot of CoffeeScript, and would love to put together a dialect that supported the Flow annotations.

            1. 2

              Traceur supports type annotations to some extent as an experimental feature, but I’ve never tried it.

              The type annotations are also part of the plan for ES Harmony as far as I can tell, with the Flow syntax being one of the options.