That's not the reason.
TypeScript's main design goal was to enable developers to gradually introduce types in codebases that spent years being written purely in JS.
There's still demand for this feature and those who start off with TypeScript set their own config anyway.
I've dealt with people using all kinds of escape hatches, but 2/3 of the time it's caused by lack of proficiency in the language.
The rest is either someone being in a hurry or just not serious about their job.
function mutateArray(
arr: (string | number)[]
) {
arr.push(1);
}
const a: string[] = ["one", "two"];
mutateArray(a);
a is now a string[] with a number insideIs there a name for this failure mode?
I came across it on ThePrimeagen's YouTube channel: https://youtu.be/u1WmiqlrqL0