tests/cases/compiler/contextuallyTypedParametersWithInitializers.ts(24,24): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/contextuallyTypedParametersWithInitializers.ts(40,5): error TS7006: Parameter 'x' implicitly has an 'any' type. ==== tests/cases/compiler/contextuallyTypedParametersWithInitializers.ts (2 errors) ==== declare function id1(input: T): T; declare function id2 any>(input: T): T; declare function id3 any>(input: T): T; declare function id4 any>(input: T): T; declare function id5 any>(input: T): T; const f10 = function ({ foo = 42 }) { return foo }; const f11 = id1(function ({ foo = 42 }) { return foo }); const f12 = id2(function ({ foo = 42 }) { return foo }); const f13 = id3(function ({ foo = 42 }) { return foo }); const f14 = id4(function ({ foo = 42 }) { return foo }); const f20 = function (foo = 42) { return foo }; const f21 = id1(function (foo = 42) { return foo }); const f22 = id2(function (foo = 42) { return foo }); const f25 = id5(function (foo = 42) { return foo }); const f1 = (x = 1) => 0; // number const f2: any = (x = 1) => 0; // number const f3: unknown = (x = 1) => 0; // number const f4: Function = (x = 1) => 0; // number const f5: (...args: any[]) => any = (x = 1) => 0; // any const f6: () => any = (x = 1) => 0; // number const f7: () => any = (x?) => 0; // Implicit any error ~~ !!! error TS7006: Parameter 'x' implicitly has an 'any' type. const f8: () => any = (...x) => 0; // [] declare function g1(x: T): T; declare function g2(x: T): T; declare function g3(x: T): T; declare function g4(x: T): T; declare function g5 any>(x: T): T; declare function g6 any>(x: T): T; g1((x = 1) => 0); // number g2((x = 1) => 0); // number g3((x = 1) => 0); // number g4((x = 1) => 0); // number g5((x = 1) => 0); // any g6((x = 1) => 0); // number g6((x?) => 0); // Implicit any error ~~ !!! error TS7006: Parameter 'x' implicitly has an 'any' type. g6((...x) => 0); // [] // Repro from #28816 function id(input: T): T { return input } function getFoo ({ foo = 42 }) { return foo; } const newGetFoo = id(getFoo); const newGetFoo2 = id(function getFoo ({ foo = 42 }) { return foo; }); // Repro from comment in #30840 declare function memoize(func: F): F; function add(x: number, y = 0): number { return x + y; } const memoizedAdd = memoize(add); const add2 = (x: number, y = 0): number => x + y; const memoizedAdd2 = memoize(add2); const memoizedAdd3 = memoize((x: number, y = 0): number => x + y); // Repro from #36052 declare function execute(script: string | Function): Promise; export function executeSomething() { return execute((root: HTMLElement, debug = true) => { if (debug) { root.innerHTML = ''; } }); } const fz1 = (debug = true) => false; const fz2: Function = (debug = true) => false;