Live data from Hacker News

Announcing TypeScript 2.2

blogs.msdn.microsoft.com

41–50 of 123 posts

Re: Announcing TypeScript 2.2

#41
post #25
post #5

Earlier quoted context omitted.

Can you show a few examples of where this is useful?

You can read the proposal and discussion around the feature on the github suggestion page for this feature. The initial suggestion was made because there are certain functions in JavaScript that expect a non-primitive type in order to function. Such as Object.create, Object.getPrototypeOf, etc. Previous to this there was no way to model the functions with type safety, such that a developer would be prevented from acc…

Thanks. Sounds useful especially for library authors.

Re: Announcing TypeScript 2.2

#42
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.

For passersby who were confused like I was: IntelliJ Community Edition has absolutely no support for Javascript or Typescript, which is not noted clearly in the help docs. You apparently need Ultimate Edition to get it.

I was real excited that I could finally use the same IDE for front-end and back-end too... :/

Re: Announcing TypeScript 2.2

#43
post #33
post #27

Earlier quoted context omitted.

Avoid vendor locking. Someday in near future if you don't like flow anymore, you can just strip all type annotations with Babel and move on. You are not risking ending up like coffeescript.

TypeScript compiles to JS in a straightforward manner as well. If you wanted to move away from TS, you could simply have the TS compiler compile to ES6 and you're done.

But that'd still be transpiled code, right? After getting rid of flow it will be exactly same minus the type annotations. Same cannot be said about typescript considering various language features and syntactic sugar TS offers. Will it run? Yes. Will it feel that it was written by me? That depends.

Re: Announcing TypeScript 2.2

#44
post #32
post #17

Earlier quoted context omitted.

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…

Well that solved some problems (e.g. importing from react-router/lib/*) but autocomplete for TSX is non-functional. Still pretty frustrating considering ES6 works out of the box.

I could be doing things wrong but in my exp, Webstorm's autocomplete is non-existent for anything that you import

Re: Announcing TypeScript 2.2

#45
post #32
post #17

Earlier quoted context omitted.

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…

Well that solved some problems (e.g. importing from react-router/lib/*) but autocomplete for TSX is non-functional. Still pretty frustrating considering ES6 works out of the box.

I've been working VS Code with TypeScript regularly for over a year now. It sounds like you want to stay in Intellij, but the language services experience in VS Code is top notch for TypeScript.

Re: Announcing TypeScript 2.2

#46
post #43
post #33

Earlier quoted context omitted.

TypeScript compiles to JS in a straightforward manner as well. If you wanted to move away from TS, you could simply have the TS compiler compile to ES6 and you're done.

But that'd still be transpiled code, right? After getting rid of flow it will be exactly same minus the type annotations. Same cannot be said about typescript considering various language features and syntactic sugar TS offers. Will it run? Yes. Will it feel that it was written by me? That depends.

With target esnext, it produces almost the same output with some spacing differences. Sans the annotations obviously.

Re: Announcing TypeScript 2.2

#47
post #24

Earlier quoted context omitted.

Why would flow + es6 be better?

One reason flow might be considered "better" (context is key) is that it plays well with the babel ecosystem, letting one pick and choose their language features.

Picking and choosing language features via babel plugins (many of which will never become part of JavaScript) is an anti-feature. You essentially are creating your own language that only you understand.

Re: Announcing TypeScript 2.2

#48

Earlier quoted context omitted.

One reason flow might be considered "better" (context is key) is that it plays well with the babel ecosystem, letting one pick and choose their language features.

Typescript and Babel play well together, too.

Yeah, I personally don't mess around with Babel but I imagine you could just take TypeScript's ES6 output and feed it through babel in your gulp/webpack pipeline.

Re: Announcing TypeScript 2.2

#49
post #42
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.

For passersby who were confused like I was: IntelliJ Community Edition has absolutely no support for Javascript or Typescript, which is not noted clearly in the help docs. You apparently need Ultimate Edition to get it. I was real excited that I could finally use the same IDE for front-end and back-end too... :/

The price gets lower each year for the first few years you renew your license.

My company pays for my license but I think it's hella worth it and I'd pay it on my own if I had to.

I avoid VS like the plague and I've never really felt at home in an IDE until I started using IntelliJ.

It's the only thing that was able to get me off of Notepad++

Re: Announcing TypeScript 2.2

#50

I know this probably comes up each typescript thread, but I still cannot figure out why I should use TS instead of flow + es6, and maintaining the typing definitions always discourages me as it's one more thing that needs to be kept up to date. Am I working on old information here?

I like Flow and I am actually using it right now, but I also see some negatives

It still feels like very much in beta. Things break often along the edges, there are things like interfaces that work only sometimes, the modules are always working strangely

Also, and that might be a personal thing, but for me, TypeScript itself has a more readable source code, since it's in TypeScript. Flow is in OCaml, which I cannot read.

On the other hand, I like how Flow is very "thin", and how I am just using ES6 with types "hints" on top; that's why I prefer Flow.

Post reply on HN