I'm developing a small app in Angular 2 with TypeScript, and I've run into an issue.
Suppose I have a variable num declared as a number and I'm using ngModel to bind it to an input box in a form. When I get the value back, and check the type, it is actually now a string, and not a number anymore, so when do a check for num >= 0, it actually comes back true if the input contains empty string because of normal JavaScript behavior.
Now is this a bug in TypeScript or is there some way to get the correct datatype back? I would expect them to be doing proper coercion behind the scenes so I don't have to.
EDIT: plunk here