Recently, I saw an article that TypeScript is now #1 on GitHub! That is what I used for writing the Mensa Member Connection app. Last week, I had another technical assessment for a job. However, this time, it was a take-home assessment on primarily JavaScript, though they use TypeScript. So, I decided to slow down and go through The TypeScript Handbook. I went in expecting a paradigm shift. What I found instead was JavaScript wearing a fake mustache and pretending it hadn’t always wanted types.
I often times mention that my native language from CalPoly is C++. JavaScript, PHP, Python, and other scripting languages are not type-centric. But apparently, the industry is finally going back to heavily typing their languages. With so many companies now insisting that we all “know TypeScript”, it can feel rather intimidating. Yet, imagine my surprise when I finally looked at it:
C++: int n = 42; std::string s = "hello"; bool b = true; std::vector<int> a = {1, 2, 3};
TypeScript: let n: number = 42, s: string = "hello", b: boolean = true, a: number[] = [1, 2, 3];
JavaScript: let n = 42, s = "hello", b = true, a = [1, 2, 3];
So it turns out TypeScript isn’t a brave new language at all — it’s just JavaScript admitting it needed adult supervision. This was my same reaction with a class… or rather object:
C++:
class Widget {
public:
int id;
std::string name;
bool active;
};
TypeScript:
class Widget {
id: number;
name: string;
active: boolean;
}
JavaScript: None!
const widget = { id: 1, name: "demo", active: true };
After a decade of being told that types were unnecessary, it’s oddly comforting to watch the industry rediscover them… and then market the rediscovery as innovation, like… a function declaration! Again, in JavaScript, there are no declarations at all! So, TypeScript just feels like… write code in JavaScript but use that naturally learned C++ for starting the function:
C++:
void process(std::string name, int count, bool enabled) {
// do something
}
TypeScript:
function process(name: string, count: number, enabled: boolean): void {
// do something
}
JavaScript:
function process(name, count, enabled) {
// do something
}
And then there’s the moment where TypeScript finally admits what JavaScript has been doing all along: sometimes a thing is this, sometimes it’s that, and sometimes it’s null because, of course, it is. In C++, this kind of thing usually requires templates, variants, or a very careful comment explaining what should happen:
C++:
std::variant<int, std::string> value;
TypeScript, once again, simply asks you to be honest about it:
TypeScript:
let value: number | string | null;
In JavaScript, this is just… Tuesday:
JavaScript:
let value = 42;
value = "hello";
value = null;
Union types don’t introduce new behavior — they just force JavaScript to stop pretending it always knows what it’s doing. And for anyone coming from C++, this feels less like learning a new concept and more like watching dynamic typing finally put its cards on the table.
Before I actually dug into TypeScript, I assumed that coming from C++, it wouldn’t be a big leap. Turns out I was right — just not for the reason I expected. TypeScript isn’t a new way of thinking; it’s JavaScript finally writing things down. The real learning curve isn’t variables or functions, but structural typing, unions, and the realization that none of this exists at runtime anyway. In the end, TypeScript feels less like a revolution and more like a long-overdue confession.