Live data from Hacker News

Announcing TypeScript 2.1

blogs.msdn.microsoft.com

61–70 of 226 posts

Re: Announcing TypeScript 2.1

#61
post #8

It's interesting to me that all of the initial reactions I've seen to this announcement have been around the introduction of async and object spread, which are available with babel, but the typescript specific features such as mapped types are completely ignored. I don't really have any particular meaning behind that observation, only that it tickled my funny bone a little bit.

"the typescript specific features such as mapped types are completely ignored"

Oh, for me it's just because I'm to dumb to grasp them ;)

Joke aside, I knew the other features from JavaScript already. I used them for half a year now and know what they give me. The rest is something I probably will apreciate when the time comes and I need it.

Re: Announcing TypeScript 2.1

#62
post #38

Been a Linux developer for ages C# was never my taste, I'm still a bit Microsoft-hatred as of now(Visual Studio Code is the only item I adopted for JS development, the rest languages I still use vi/Geany). How tightly TS is related to C#? That has been the main reason I had not tried TS seriously so far. Don't want to have anything to do with C#. I know...

> How tightly TS is related to C#?

TS is a superset of ES6+. So, not much. Dart is closer to C#, I'd say.

C# is a well-designed language, though. You can't say that about the first iterations of JS and none of its baggage was ever dropped for the sake of maintaining backwards compatibility.

TS gently pushes you in a more modern direction, which means that those JS issues matter much less in practice. It works pretty well. It does what it's supposed to do; it makes working on larger projects much more manageable.

If you write a lot of JS, I highly recommend to check it out.

Re: Announcing TypeScript 2.1

#63
TypeScript is great. I built https://www.findlectures.com over a year, starting in plain Javascript. Once the codebase was large enough that got stuck I added TypeScript, and it's been great for isolating defects.

It's nice paired with React (vs PropTypes) because the checking happens a lot earlier and is much richer.

Re: Announcing TypeScript 2.1

#64
post #36

Coming from Java land, TS is a life saver for front-end development. Any plans for .NET Core / CLR backend ? I think, this will be the silver bullet. TS types should be able to generate statically compiled bytecode => native binary ?

You can create TypeScript models from C# already. TypeLITE[0] will generate TS models using T4 templates. TypeWriter[1] is a visual studio extension that regenerates TS models whenever you save a file.

[0] - http://type.litesolutions.net/

[1] - https://frhagn.github.io/Typewriter/

Re: Announcing TypeScript 2.1

#65

The easier imports solves my biggest issue with migrating an existing project over. I'd say TypeScript is "ready" now. The last feature I'd want is an easy way to map nested json into classes rather than interfaces. Anyone know how?

An approach I've seen is to have each class extend from some abstract base class (I know, OO blech) that looks like this: abstract class AbstractClassObject { constructor(json?: any){ if (json){ this.updateFromJSON(json) } } public updateFromJSON = (json: any): this => { Object.assign(this, json); return this; } } That gives you the "magic" just by extending the base, while also allowing custom behavior for a given c…

That only works for primitive types. As soon as you start using classes and sumtypes then you need an explicit parser. I wrote one for a client about a year ago. It took a lot of effort but well worth it.

Re: Announcing TypeScript 2.1

#68

If you still haven't given TypeScript a go as a Javascripter, now is a great time to do so. Whether you end up adopting it or not, it's interesting to get the types out of your mind and into the code. The first time you feel the speed/confidence of refactoring with accurate 'Find usages', you'll decide if the undeniable overhead of types is worth it.

Can anyone weigh in on TypeScript vs Elm?

Re: Announcing TypeScript 2.1

#70
post #57

Feels like Typescript is building (or has built up?) more momentum than Flow.

Its true and unfortunate. Typescript is the new Coffeescript. It splits the ecosystem. Flow is a progressive enhancement and improves the ecosystem. Typescript has had more push in the mindshare marketing from Microsoft.

TypeScript doesn't split the community any more than Flow does. TypeScript remains very close to ES2016/2017, syntax-wise, with the only major difference being type annotations, but you have those with flow as well. Anybody who can read JavaScript can read TypeScript.
Post reply on HN