TypeScript, I guess. But why?

I’m well aware that everybody has jumped on the TypeScript bandwagon, but I have been holding out. I guess I’m a holdout because I like vanilla JavaScript. I don’t actually need types. I don’t really understand why anyone ever needs them. If you want to use a function, you figure out what types it accepts (from documentation or whatever), and that is what you put into that function. Is that hard for people?

That said, I decided to finally learn at least a little TypeScript. I think the best way to learn anything is to do it. For example, when learning a new language (or even a new programming style) one of the first things I always do is implement the classic sorting algorithms in that language or style.

TypeScript is not a language. It is a superset of JavaScript. Since I have already done that exercise in JavaScript, I have done it in TypeScript (sort of).

So, anyway, I transformed my xerocross.functionality-util project into a TypeScript project. It’s sort of interesting maybe. The functional programming is a much more interesting learning experience for me. TypeScript is just something I’m tacking on. So far I still don’t think TypeScript is useful at all. And yes, I have added the type declarations and such to turn my files into real .ts files. I discovered that I had not attempted to plug a string type into a function expecting a number. That wasn’t surprising.

Maybe I’ll read some stuff and try to let the Internet convince me that TypeScript is worth the bother. I’ll do it mainly because the industry says I need to know it. But so far I’m not sold.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s