TypeScript is Secretly Just C#
TypeScript is MOSTLY just a way of bringing C# methodology to building applications in JavaScript.
Call me Captain Obvious! They are both Microsoft products.
But I've been learning C# and the similarities have been interesting!
Here are the things that are really nice about working in C# so far:
- It's a compiled language. SO there are some errors that are caught at compile time, like undeclared variables.
- Intelisense is strong here. Typing values right out the gate makes that all the easier.
- Self documentation is pretty wicked in Visual Studio. Opening up the Assembly Browser gives you access to ALL the properties and methods for objects and classes that are used in your project.
- Enums! From the TypeScript docs: "Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript."
- Interfaces and Generic Types also are a borrowed C# concept!
The only exception might be that C# is a classic object oriented programming language where JavaScript and TypeScript mostly fake that part, being much more dynamic. Arguably, though, some of the tooling already gets you pretty close — component based frameworks, for example.
The "TypeScript is just JavaScript" sentiment has strangely made TypeScript difficult to learn for me. Similar to Node vs ES6 — the fact that they're so similar makes it difficult to remember that your brain needs to work in a different paradigm. It helps when I'm learning about Types in a language that is strongly typed from the get-go.
So I'll say this much: learning C# has been a really fun way to also learn TypeScript.