OK, but what’s the big deal with static typing?
Well, did you ever come across the dreadful
Undefined is not a function error?
This is sometimes useful.
But knowing in advance that a given variable is a React component rather than a, I don’t know, a string proved to be really valuable.
Having type annotations makes reading and maintaining code so much easier.
The extra hassle of creating types and occasionally fighting with the compiler really pays off.
Static vs. dynamic typing is actually a decades-old debate. No matter which side you are on, the popularity of TypeScript is astounding. As a matter of fact, all new frontend projects I know use TypeScript these days.
The type system offered by TypeScript is actually quite advanced. It supports:
- union types
- structural typing
…and much more.
Null-safety is especially worth mentioning.
Basically, TypeScript compiler (
tsc for short) tracks possible
tsc fails at build tiem with a type error.
Programs that don’t compile can’t fail on production.
TypeScript was originally created by Microsoft.
By the way, Microsoft also gave us Visual Studio Code and AJAX.
AJAX being the father of
Also GitHub, after being acquired, improved significantly.
And Microsoft was once the top Linux kernel contributor.
So I think Internet Explorer and Windows Millenium Edition should be forgiven.
That’s it, thanks for listening, bye!
- Official website
Null: billion-dollar mistake
- TypeScript on Wikipedia
- Deno running TypeScript
- Top Five Linux Contributor: Microsoft
- Fetch API
- undefined is not a function on StackOverflow
- #14: Static, Dynamic, Strong and Weak Type Systems