When it comes down to it, TypeScript is always transformed into JavaScript. This means that essentially you are combining a string '1' with the number 2. JavaScript will automatically convert the number to a string because adding a string and a number directly is not feasible.
If you define a type for the variables being sent to the function, the TypeScript transpiler will detect an error:
var a: number = '1';
var b: number = 1;
add_numbers(a, b);
Error:
Type mismatch found on line one
var a: string = '1';
var b: number = 1;
add_numbers(a, b);
Error:
Incorrect parameter type in function call