TypeScript Structural it is

100DaysOfCode

TypeScript

100DaysOfCode – Day 6 & 7 – TypeScript

I started with TypeScript because it was taking too much space at the back of my head, being now for a few months just working on my front-end skills, TypeScript was appearing again and again in different forms, as a mention, as a .ts file in some project, and so on, so I needed to see what was the fuzz about.

This time I went to the source https://www.typescriptlang.org/ , not shortcut articles promising to learn in 4 minutes everything that you need to know. I just wanted to know what makes it so special and give it a small try.

In their website you can find all that you need, the 5 minutes guide, that I took but I found too basic and not too many answers, but it’s good you don’t want to get overwhelmed by too much detailed information, and honestly it said 5 minutes , what did I expect?

So I went for the Playground section, and it was much better, I did quite a lot of them and it shows you the differences between plain Vanilla JavaScript and TypeScript, that’s good, something that you can see how does work and understand. Hands on!

And there was some other sections that took my attention :

TS for OO Programmers and TS for JS Programmers

These are guides again of 5 minutes but where you see which are the difference or the similarities between what do you know and you don’t. And there is when I got it what this structural system was. With the example below:

class Car {
  drive() {
    // hit the gas
  }
}
class Golfer {
  drive() {
    // hit the ball far
  }
}

// No error?
let w: Car = new Golfer();

This isn’t an error because the structures of these classes are the same. While this may seem like a potential source of confusion, in practice, identical classes that shouldn’t be related are not common.

Still not sure how to get this but I’ll learn about it, and that was all for my 2 days in TypeScript, for sure I will be back, I like some aspects and I need to understand more about the advantages in comparison with JavaScript.