I've written many words about TypeScript and I'm sure I've read even more. Here are four words that make me cringe every time I see them. If you write about TypeScript, please steer clear of these!
This one is hyphenated, sorry. I don't like it because no one can agree on what "strongly-typed" means. The TypeScript types that look "strong" to you coming from a Java background might look weak to a Haskell developer. Or to someone who's been using TypeScript a bit longer. And can types that go away at runtime really be considered strong?
When you write "strongly typed," perhaps you mean to write "statically typed" (which TypeScript is) or "sound" (which it isn't)? Adding to the confusion, a weak type is something very specific in TypeScript, and it's probably not the opposite of the "strong types" that you have in mind.
Expertise in programming is less about using "advanced" features and more about learning how to effectively use the basic building blocks of your language. To me, using the word "advanced" when discussing features like conditional types implies that that the more you use these features, the more "advanced" you are as a TS programmer. I prefer the word "fancy" (as in "fancy types") since that has more accurate connotations about how often you really need to use these features. After all, the first rule of generics is to avoid them if you can.
The correct term for the expression
x as numberis "type assertion". I don't like the word "cast" because in most languages (C, C++, Java, Rust, …), a cast can have an effect at runtime. In C, for example,
(int)fwill convert a
intby rounding down. But because TypeScript types are erased at runtime, the
as numbercan't possibly have an effect. If you look at the generated JS in the TypeScript playground, you can see this plainly. It's called a "type assertion" because you're asserting that the value already has the type you say it does. You're not "casting" it into that type. Item 9 of Effective TypeScript, Prefer Type Declarations to Type Assertions, has much more to say about exactly when it's appropriate to use type assertions.
I always try to maintain a positive tone in public forums, and I certainly don't want this post to discourage anyone from writing about
Typescript TypeScript. If you've learned something about the language and want to share it online, that's great! I hope you do. But please avoid these four terms!