3 ms·
For example (continuing my sibling comment), if you unroll it properly, you do get TypeScript complaints. parseInt("10", 0, ["10", "10", "10"]) parseInt("1
by jjnoakes 4y ago
For example (continuing my sibling comment), if you unroll it properly, you do get TypeScript complaints.
parseInt("10", 0, ["10", "10", "10"])
parseInt("10", 1, ["10", "10", "10"])
parseInt("10", 2, ["10", "10", "10"])
https://www.typescriptlang.org/play?#code/ATAOEMCcGcFMEkB2AXAFAIgIwAZ0BphsCBtLXAs-YSgXQEoAoECGBFDHKzEyizv3PSZgocJGl7AATD37U5tOkA https://www.typescriptlang.org/play?#code/ATAOEMCcGcFMEkB2AX...
So TypeScript intentionally suppresses this kind of complaint when matching up function types even though it issues them when calling functions directly. The reason for that has a justification, but in contexts like this, I think it is a WAT-worthy interaction.
https://github.com/microsoft/TypeScript/wiki/FAQ#why-are-functions-with-fewer-parameters-assignable-to-functions-that-take-more-parameters https://github.com/microsoft/TypeScript/wiki/FAQ#why-are-fun...