TypeScript Version: 2.1.5
Code
const myString = 'foo';
const myNumberThatShouldBeAString = 123;
myString.replace('a123', myNumberThatShouldBeAString);
Expected behavior:
Error on 2nd argument with message "Argument of type Number is not assignable to parameter of type 'String'.
Actual behavior:
Error on 1st argument with message "Argument of type '"a123"' is not assignable to parameter of type 'RegExp'."
Indeed, there's no signature for String.replace() in lib.es6.d.ts with number as 2nd argument, so Typescript should find error on the latter, and not on the first argument, which matches one of the signatures.