Why and when to use TypeScript:
*Safety
TypeScript catches type errors early through static analysis:
function double(x: number): number {
return 2 * x;
}
double('2');
// ~~~ Argument of type '"2"' is not assignable to parameter of type 'number'.