Typescript is said to be an objected oriented form of javascript , allows type safety inheritance etc. But why it does not prevent to declare same name variable as its parameter inside body of method.
This could be very problematic specially when user forget and declare a variable with same name as its parameter and this cause overriding and lost of previous value stored in that variable.
Example Typescript:
function greeter(person : Person,b="") {
var b = "3";
//No warning in this case
}
Example C#:
public void greeter(Person person ,string b="")
{
string b = "3";
//Error A local parameter name cannot be declare in sc
}
Please help , or tell me is there any method to avoid such condition in Typescript?