Live data from Hacker News

TypeScript 0.9 – What’s Improved

flippinawesome.org

11–20 of 24 posts

Re: TypeScript 0.9 – What’s Improved

#11
My team has been using TypeScript since 0.9 was released. From our perspective it's been a great win. It's greatly eased the refactoring of our JavaScript.

The thing that's been really nice is the ability to write a certain amount of ES6 style code (eg using arrow functions to lexically bind the this value) and having the TypeScript compiler transpile that into ES5 / ES3 JavaScript.

I really like it. I think the tooling is still a little rough but it's still in Alpha so that's fair enough I guess. It'll improve.

Re: TypeScript 0.9 – What’s Improved

#12
post #3

Is TypeScript a superset of JavaScript? Or is there valid JavaScript that doesn't compile in TS?

There are a few language corners that don't translate, such as:

    var x = "".constructor(5);
    // The property 'constructor' does not exist on value of type 'String'.
The exceptions make sense if you dig into how the type system works. AFAIK these can always be worked around with an explicit cast to any:

    var x = ("").constructor(5);
I've found TypeScript to be a huge win for maintainability, and can't imagine going back to raw JS for an app of any complexity. I'd love to have a chance to pair it with Node for something.

Re: TypeScript 0.9 – What’s Improved

#13
I think typescript is such a good idea. And generics is a great addition.

The only thing I dislike about TS is the way it handles dependencies. The require/declare/import/export methodology confuses me. And on top of that there is the // tag, and all of it seems to be relying on files, rather than on constructs in the code. Relying on files, means that I have to maintain the order of which to import what, and this becomes even harder if some of the files contain code that is not just module/class definitions, but actual statements in global scope.

Re: TypeScript 0.9 – What’s Improved

#14
I feel so productive in Typescript. I remember the feeling I got when I realized how powerful the type system in Haskell was, and how useful it was at catching mistakes. Every once in a while I read an article about Haskell and think I should get better at it, then I realize that Typescript is really the best of both worlds. It turns JavaScript into this awesome productive language that can scale to large projects.

Re: TypeScript 0.9 – What’s Improved

#15
post #13

I think typescript is such a good idea. And generics is a great addition. The only thing I dislike about TS is the way it handles dependencies. The require/declare/import/export methodology confuses me. And on top of that there is the // tag, and all of it seems to be relying on files, rather than on constructs in the code. Relying on files, means that I have to maintain the order of which to import what, and this be…

One of the major problems with JavaScript has always been that there are too many options. I feel like TS reduces some, but it still lets people choose between a module pattern (AMD, CommonJS), and the traditional everything-in-the-global-scope way of writing programs.

So you're left feeling confused because there is more than one way to write a program. Options are good and all, but in the front-end Javascript community, I think we could deal with fewer of them.

To solve your own problem: I would recommend using CommonJS with Browserify for everything, and only use reference tags for ambient declarations. (.d.ts files). Then you'll always use import and export

Re: TypeScript 0.9 – What’s Improved

#16
post #13

I think typescript is such a good idea. And generics is a great addition. The only thing I dislike about TS is the way it handles dependencies. The require/declare/import/export methodology confuses me. And on top of that there is the // tag, and all of it seems to be relying on files, rather than on constructs in the code. Relying on files, means that I have to maintain the order of which to import what, and this be…

TypeScript doesn't handle dependencies. The tag is just for the compiler to know where to find the type definitions you are using in a file. For proper dependency handling you still need to use something like RequireJS.

Re: TypeScript 0.9 – What’s Improved

#17
post #4

Regarding noImplicitAny, I find the choice of a compiler option rather than source code markup (like "user strict") rather odd. Granted there's no standard way to do that, but still...

why? compilers for other languages has compile time switches for various checks and/or optimizations, there it is assumed normal. Javascript's "use strict" is just a hack for lack such option. This has some benefits, i.e. you take some codebase that must compile with noImplicitAny and want to add some features, you start with less strict typing (implicit any allowed), when finished you compile with different flag. Because ide (most people use) is recompiling the code all the time there is no reason to clutter this when prototyping. If you don't like this workflow, just use the flag from step 1.

Re: TypeScript 0.9 – What’s Improved

#18
After using TypeScript for awhile, I really can't think of a reason not to use it. I haven't read anyone else express a reason not to use it. If it ever turns out to be a problem, then I can just switch over to working on the JavaScript output and dump the TypeScript front with almost zero effort. I did some refactoring the other day and it became clear that TypeScript is a tool that makes life easier and there probably is no good reason not to use it.

Re: TypeScript 0.9 – What’s Improved

#19
post #14

I feel so productive in Typescript. I remember the feeling I got when I realized how powerful the type system in Haskell was, and how useful it was at catching mistakes. Every once in a while I read an article about Haskell and think I should get better at it, then I realize that Typescript is really the best of both worlds. It turns JavaScript into this awesome productive language that can scale to large projects.

I like Typescript too, but this is a little over the top. Typescript's typing is nowhere near as expressive as Haskell's is (nor was it ever intended to be). I think of it more as a nicer way of doing Closure Compiler-like annotations plus you get a built in transpiler for many of the handier es6 features.

edit: oh, and tooling, but I'm not normally on Windows for development so I haven't played much with the Visual Studio integration.

Re: TypeScript 0.9 – What’s Improved

#20
post #14

I feel so productive in Typescript. I remember the feeling I got when I realized how powerful the type system in Haskell was, and how useful it was at catching mistakes. Every once in a while I read an article about Haskell and think I should get better at it, then I realize that Typescript is really the best of both worlds. It turns JavaScript into this awesome productive language that can scale to large projects.

I like Typescript too, but this is a little over the top. Typescript's typing is nowhere near as expressive as Haskell's is (nor was it ever intended to be). I think of it more as a nicer way of doing Closure Compiler-like annotations plus you get a built in transpiler for many of the handier es6 features. edit: oh, and tooling, but I'm not normally on Windows for development so I haven't played much with the Visual…

Typing isn't just about catching type errors, but about semantic feedback useful for tooling. Unless you are using Haskell, then its just about catching type errors.
Post reply on HN