Which of these callback parameters does TypeScript infer, and which one is an error?
Name the type each ^? line points at, and every error TypeScript reports under strict.
const names = ["ada", "grace"]; const lengths = names.map((name) => name.length);// ^? type Formatter = (value: number, digits: number) => string;const format: Formatter = (value, digits) => value.toFixed(digits);// ^? const toLength = (name) => name.length;names.map(toLength);Work it out first: the compiler shows every error and type.
The answer
Work out every error TypeScript reports and every type it shows, line by line. Then check.
Checking your sign-in…