Live data from Hacker News

Announcing TypeScript 2.2

blogs.msdn.microsoft.com

11–20 of 123 posts

Re: Announcing TypeScript 2.2

#11
post #4

Earlier quoted context omitted.

Non-nullable This is incorrect, as is the announcement. The following is valid. class Bar{} let foo:object = new Bar() foo = null foo = undefined edit: For the people mentioning, --strictNullChecks. That applies to all types not just object. For example, "let x:string = null" would also be an error. That option applies to any type that is not of type Any/null/undefined, and has been in place since 2.0. In that way, "…

No, object is not a nullable type. For your code to work, you'd need to run it with strictNullChecks disabled. That's probably what you're doing, since it's the default.

Without `--strictNullChecks`, both `undefined` and `null` are in the domain of all types.

Re: Announcing TypeScript 2.2

#12
post #4
post #2

My favorite: the new `object` type. Non-nullable and cannot refer to primitives.

Non-nullable This is incorrect, as is the announcement. The following is valid. class Bar{} let foo:object = new Bar() foo = null foo = undefined edit: For the people mentioning, --strictNullChecks. That applies to all types not just object. For example, "let x:string = null" would also be an error. That option applies to any type that is not of type Any/null/undefined, and has been in place since 2.0. In that way, "…

Thanks for catching - I've updated the blog post. I tend to just use `strictNullChecks` by default, as it's typically the best option for any new code. :)

Re: Announcing TypeScript 2.2

#13
Speaking of tooling -- has anyone had a good experience with Typescript in IntelliJ/Webstorm? It does a fantastic job figuring out ES6 code but seems to totally choke on Typescript. I'd like to avoid switching to Visual Studio.

Re: Announcing TypeScript 2.2

#14
Crumbles from the design-table. Oh look, a new object type. I'm not even sure this is an improvement to straight JS any more, it just fails in more exotic ways from pretending to be something it isn't. Once the choice is made to compile to JS, there are plenty of real languages to choose from.

Re: Announcing TypeScript 2.2

#15
post #13

Speaking of tooling -- has anyone had a good experience with Typescript in IntelliJ/Webstorm? It does a fantastic job figuring out ES6 code but seems to totally choke on Typescript. I'd like to avoid switching to Visual Studio.

That's odd. I work in a 100% typescript shop and about half the devs use intellij and webstorm full time without much trouble.

Jump to definition/auto import/implement interface/etc all work.

Re: Announcing TypeScript 2.2

#16
post #13

Speaking of tooling -- has anyone had a good experience with Typescript in IntelliJ/Webstorm? It does a fantastic job figuring out ES6 code but seems to totally choke on Typescript. I'd like to avoid switching to Visual Studio.

That's odd. I work in a 100% typescript shop and about half the devs use intellij and webstorm full time without much trouble. Jump to definition/auto import/implement interface/etc all work.

I'll second that. I use an IDE from the Intellij family and things work fine.

Re: Announcing TypeScript 2.2

#17
post #13

Speaking of tooling -- has anyone had a good experience with Typescript in IntelliJ/Webstorm? It does a fantastic job figuring out ES6 code but seems to totally choke on Typescript. I'd like to avoid switching to Visual Studio.

Make sure you turn on the native TypeScript Language Service feature, otherwise you'll be getting your IDE's parser, which is always behind the standard and doesn't work very well:

> Select the Use TypeScript Service check box to get native support from the TypeScript Language Service according to the up-to-date specifications. In this case syntax and error highlighting is performed based on the annotations retrieved from the TypeScript Language Service while code completion lists contain both suggestions from the TypeScript Language Service and suggestions calculated by IntelliJ IDEA itself.

https://www.jetbrains.com/help/idea/2016.2/typescript-suppor...

Re: Announcing TypeScript 2.2

#18
post #4

Earlier quoted context omitted.

Non-nullable This is incorrect, as is the announcement. The following is valid. class Bar{} let foo:object = new Bar() foo = null foo = undefined edit: For the people mentioning, --strictNullChecks. That applies to all types not just object. For example, "let x:string = null" would also be an error. That option applies to any type that is not of type Any/null/undefined, and has been in place since 2.0. In that way, "…

No, object is not a nullable type. For your code to work, you'd need to run it with strictNullChecks disabled. That's probably what you're doing, since it's the default.

since it's the default.

It's not the default for the command line compiler. Also, all types (except Any/null/undefined) are non-nullable under that option, so that's not what makes object special (it's the no primitive types that is important).

  >tsc test.ts
  >tsc test.ts --strictNullChecks
  >  test.ts(3,1): error TS2322: Type 'null' is not assignable to type 'object'.

Re: Announcing TypeScript 2.2

#19
post #13

Speaking of tooling -- has anyone had a good experience with Typescript in IntelliJ/Webstorm? It does a fantastic job figuring out ES6 code but seems to totally choke on Typescript. I'd like to avoid switching to Visual Studio.

IntelliJ Ultimate user here, writing and refactoring TS works quite well. There are some minor issues (e.g. sometimes it doesn't show the usual "this method is overridden in a child class" indicator), and refactoring likes to randomly modify somearray['foo'] when renaming a someclass.foo property, but I can live with that.
Post reply on HN