Live data from Hacker News

Announcing TypeScript 2.0 Beta

blogs.msdn.microsoft.com

1–10 of 95 posts

Re: Announcing TypeScript 2.0 Beta

#2
The control-flow analysis of types is very clever.

I've been slowly switching away from Coffeescript to Typescript and have been mostly happy with it.

Only thing I still struggle with is grappling the namespace/modules mess in Javascript that's been inherited by Typescript.

Re: Announcing TypeScript 2.0 Beta

#3
> In TypeScript 2.0, the new --strictNullChecks flag changes that. string just means string and number means number.

This is great. However, it would be nice to know if this feature will become opt-out in the future instead of opt-in. In theory, if you're a TS user (as opposed to JS) it's because you want these nice features _by default_.

Re: Announcing TypeScript 2.0 Beta

#4
post #3

> In TypeScript 2.0, the new --strictNullChecks flag changes that. string just means string and number means number. This is great. However, it would be nice to know if this feature will become opt-out in the future instead of opt-in. In theory, if you're a TS user (as opposed to JS) it's because you want these nice features _by default_.

Agreed!

Re: Announcing TypeScript 2.0 Beta

#6

The control-flow analysis of types is very clever. I've been slowly switching away from Coffeescript to Typescript and have been mostly happy with it. Only thing I still struggle with is grappling the namespace/modules mess in Javascript that's been inherited by Typescript.

Is it inherited from JS though? I was under the impression that Typescript was doing their own thing (like /// <reference)

Re: Announcing TypeScript 2.0 Beta

#8
post #3

> In TypeScript 2.0, the new --strictNullChecks flag changes that. string just means string and number means number. This is great. However, it would be nice to know if this feature will become opt-out in the future instead of opt-in. In theory, if you're a TS user (as opposed to JS) it's because you want these nice features _by default_.

Wouldn't that break third party libraries? You'd also need a compiler flag to enable it only for your own code.

Re: Announcing TypeScript 2.0 Beta

#9
post #3

> In TypeScript 2.0, the new --strictNullChecks flag changes that. string just means string and number means number. This is great. However, it would be nice to know if this feature will become opt-out in the future instead of opt-in. In theory, if you're a TS user (as opposed to JS) it's because you want these nice features _by default_.

It's a tough call, and I can see arguments for both sides. On the other side, one of the big selling points of TypeScript is that you can take your existing huge JavaScript codebase, and with little effort turn it into TypeScript with all the types being "any", then gradually add strong types as time permits. This wouldn't work if --strictNullChecks was the default and would add one more step to the migration process.

Re: Announcing TypeScript 2.0 Beta

#10

    let lowerCased = strs!.map(s => s.toLowerCase());
I'm not a big fan of this, it's really starting to change JS semantics. It's not just type annotations anymore + ES6 . It's starting to look like its own language. Some might like that, I do not.

They should be a bit more cautious before introducing these features. What if Ecmascript in the future uses ! as an operator for a totally unrelated purpose ? It's like decorators, they are not in the spec, there is no plan yet to officially had them to the spec, yet, Angular2 which is written in Typescript abuse them. What if in 2 years they are introduced in ES2019 with different semantics ? How Typescript is going to handle that too ?

Post reply on HN