Nov 16, 2012 at 9:56 PM
Edited Nov 16, 2012 at 9:58 PM
I accidentally tried to overload a method as follows - note the incorrect use of uppercase "String".
public static getKeyCode(value: String): number;
Everything was building fine until I tried to
call the method, e.g. StringUtility.getKeyCode("a"); Suddenly the compiler would fail with exit code 1, but with no useful error message at all. After quite awhile, I finally realized my mistake:
public static getKeyCode(value: string): number;
Now everything compiles and runs fine, but I found that to be a tricky bug to track down, especially since String is a valid type. I would've at least expected an error message complaining about me using the wrong type.