class Lol {
get length() {
console.log('Lol. LMAO even.');
return 5;
}
}
const noLolsAllowed = (notALol: string) => {
for (let i = 0; i < notALol.length; ++i) {
console.log('No lols here');
}
}
noLolsAllowed(new Lol() as unknown as string);
Yeah, at this point, I’m basically using “strongly typed” as “How expressive/useful is the type system?”.
Haskell, Rust, Scala, OCaml → Strongly typed.
Python, JavaScript, C, Go → Worse than that.
Personally, I would still put TypeScript in the strong category, because unless you are using
as
, it does have a helpful type system. A language preventing shitfuckery during runtime is kind of too late anyways.But yeah, sometimes even the best type system cannot express everything you know to be true as a human. Then you need to start casting. But casting can break during refactoring, so a language at least telling you during runtime that the cast is broken, is more helpful than a language just accepting shitfuckery. So, this does make TypeScript somewhat less strongly typed, even with my definition.