Live data from Hacker News

Why does TypeScript have be the answer to anything?

hanselman.com

31–40 of 82 posts

Re: Why does TypeScript have be the answer to anything?

#31

First of all, I'm glad Microsoft is getting involved in this space. They have a deep talent pool when it comes to language design and tooling and it'll be interesting to see where TypeScript goes. Unfortunately, the arguments trying to draw some kind of monumental distinction between TypeScript, Dart and CoffeeScript are silly. They are all a response to the state of client-side development and are all applying essen…

> essentially the same strategy (i.e., some syntax changes and a pre-compiler) TypeScript and CoffeeScript, yes. Dart's a brand new C-like web language that is quite different, and has its own VM. Although, of course, you can still compile to JS. But unlike TypeScript and CoffeeScript, it isn't really an alternative syntax for JS, or annotations removed at compile-time.

Yes, I know and you are correct.

At a high-level, though, and in the case where browsers are the target platform, those aspects are largely implementation details.

Re: Why does TypeScript have be the answer to anything?

#32

The author ignores the fact that TypeScript is being heavily promoted by Microsoft. TypeScript isn't an experiment, but something Microsoft is trying to sell, along with their IDE. He starts it with a quote from a colleague rather than citing examples of people attacking TypeScript, as if it's a forgone conclusion that people have gone overboard on attacking it. I hate to see an argument for a programming language st…

>Microsoft is trying to sell

Do you mean sell as in for money? Or sell as in get people to adopt? Under an Apache license, I doubt it's the former. Although they could sell the Visual Studio tooling.

Re: Why does TypeScript have be the answer to anything?

#33

Earlier quoted context omitted.

> essentially the same strategy (i.e., some syntax changes and a pre-compiler) TypeScript and CoffeeScript, yes. Dart's a brand new C-like web language that is quite different, and has its own VM. Although, of course, you can still compile to JS. But unlike TypeScript and CoffeeScript, it isn't really an alternative syntax for JS, or annotations removed at compile-time.

Yes, I know and you are correct. At a high-level, though, and in the case where browsers are the target platform, those aspects are largely implementation details.

With the rather large exception of filesize.

Re: Why does TypeScript have be the answer to anything?

#34
post #5

I have to build my entire project every time I want to update my client side code? That is an enormous tax to charge the developer just to add static typing to your client side code. I can't see this doing anything but slowing a team down.

I have to build my entire project

With good tools (IDE and build automation) coupled with continuous integration/deployment, this doesn't have to feel like a tax.

Re: Why does TypeScript have be the answer to anything?

#35

>Dart interops with JavaScript...but it's not JS. It doesn't even use the JavaScript number type for example. What is meant by this? As far as I know, the only way that you can use Dart in any browser currently is by compiling it to JS, and when you do that it most certainly does use native JS numbers. In fact, the type check function it creates for numbers contains this line: if (!(typeof value === 'number')) {

There is an experimental build of Chromium called Dartium that contains a Dart VM. It isn't practical for daily use, but it's a taste of things to come.

Re: Why does TypeScript have be the answer to anything?

#36
post #24

>Dart interops with JavaScript...but it's not JS. It doesn't even use the JavaScript number type for example. What is meant by this? As far as I know, the only way that you can use Dart in any browser currently is by compiling it to JS, and when you do that it most certainly does use native JS numbers. In fact, the type check function it creates for numbers contains this line: if (!(typeof value === 'number')) {

He means that the semantics of Dart - including the data types provided by Dart - are different from JavaScript. This is in opposition to TypeScript, which is a superset of JavaScript, which means that it necessarily shares JavaScrips semantics. If your example bothers you, consider that JavaScript just happens to be a target language for the Dart compiler. That is, it takes a program with Dart's semantics, and figur…

Really? Wow, that's cool. Can I have a reference?

Re: Why does TypeScript have be the answer to anything?

#37

Earlier quoted context omitted.

Poor state of JavaScript development? By what measure? I've been doing "application-scale" development using JavaScript for 5 years... Not once did I think "gee my development process would be better if I had rigid typing." The notion is laughable. The lack of rigid typing and classes is by design. This is a feature not a bug. I honestly wonder about a programmer's understanding of JavaScript if they say things like…

The type system in TypeScript isn't 'rigid'. It's both optional and structural. These combine to make it a heck of a lot more lightweight than something like C++ or Java. The classes in TypeScript are a formalisation of a very common design pattern in Javascript, so obviously people do think it's useful. TypeScript takes the common practice and makes it more succinct. (Other than inheritance, which does seem a little…

Perhaps you understand TypeScript better than I do. My rough understanding is that TypeScript is JavaScript with what's essentially inline JSDoc. The compiler is just there to give hints and warnings. Is this right?

Re: Why does TypeScript have be the answer to anything?

#38
This isn't exactly the right place, but I don't know where else to ask this.

When people argue for static types (whether optional as in TypeScript or mandatory), one of the main reasons is "tooling". Why?

I know that writing a "go to definition" function for your IDE is impossible to do 100% correctly, when types are dynamic. But I would've thought it'd be pretty easy to do a 99% implementation, which rarely fails if you don't deliberately write code to fool it. Right?

Re: Why does TypeScript have be the answer to anything?

#40
post #38

This isn't exactly the right place, but I don't know where else to ask this. When people argue for static types (whether optional as in TypeScript or mandatory), one of the main reasons is "tooling". Why? I know that writing a "go to definition" function for your IDE is impossible to do 100% correctly, when types are dynamic. But I would've thought it'd be pretty easy to do a 99% implementation, which rarely fails if…

Go to function definition, refacor/rename, find references, view object / class hierarchy, and so on. Why not have all this work 100% of the time?

Tooling makes your life so much easier. I don't understand why people would resist optional typing.

Post reply on HN