tests/cases/compiler/recursiveFunctionTypes.ts(1,28): error TS2322: Type 'number' is not assignable to type '() => typeof fn'. tests/cases/compiler/recursiveFunctionTypes.ts(3,5): error TS2322: Type '() => typeof fn' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(4,5): error TS2322: Type '() => typeof fn' is not assignable to type '() => number'. Type '() => typeof fn' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(11,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/recursiveFunctionTypes.ts(12,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/recursiveFunctionTypes.ts(17,5): error TS2322: Type '() => I' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'. tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type 'number' is not assignable to type '() => any'. tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/recursiveFunctionTypes.ts(33,8): error TS2554: Expected 0-1 arguments, but got 2. tests/cases/compiler/recursiveFunctionTypes.ts(34,4): error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. tests/cases/compiler/recursiveFunctionTypes.ts(42,8): error TS2554: Expected 0-1 arguments, but got 2. tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2769: No overload matches this call. Overload 1 of 4, '(a: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): () => number', gave the following error. Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. Overload 2 of 4, '(a: number): number', gave the following error. Argument of type 'string' is not assignable to parameter of type 'number'. Overload 3 of 4, '(a?: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }', gave the following error. Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. ==== tests/cases/compiler/recursiveFunctionTypes.ts (13 errors) ==== function fn(): typeof fn { return 1; } ~~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type '() => typeof fn'. var x: number = fn; // error ~ !!! error TS2322: Type '() => typeof fn' is not assignable to type 'number'. var y: () => number = fn; // ok ~ !!! error TS2322: Type '() => typeof fn' is not assignable to type '() => number'. !!! error TS2322: Type '() => typeof fn' is not assignable to type 'number'. var f: () => typeof g; var g: () => typeof f; function f1(d: typeof f1) { } function f2(): typeof g2 { } ~~~~~~~~~ !!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. function g2(): typeof f2 { } ~~~~~~~~~ !!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. interface I { } function f3(): I { return f3; } var a: number = f3; // error ~ !!! error TS2322: Type '() => I' is not assignable to type 'number'. class C { static g(t: typeof C.g){ } } C.g(3); // error ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'. var f4: () => typeof f4; f4 = 3; // error ~~ !!! error TS2322: Type 'number' is not assignable to type '() => any'. function f5() { return f5; } function f6(): typeof f6; function f6(a: typeof f6): () => number; ~~ !!! error TS2394: This overload signature is not compatible with its implementation signature. !!! related TS2750 tests/cases/compiler/recursiveFunctionTypes.ts:31:10: The implementation signature is declared here. function f6(a?: any) { return f6; } f6("", 3); // error (arity mismatch) ~ !!! error TS2554: Expected 0-1 arguments, but got 2. f6(""); // ok (function takes an any param) ~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. !!! related TS2793 tests/cases/compiler/recursiveFunctionTypes.ts:31:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. f6(); // ok declare function f7(): typeof f7; declare function f7(a: typeof f7): () => number; declare function f7(a: number): number; declare function f7(a?: typeof f7): typeof f7; f7("", 3); // error (arity mismatch) ~ !!! error TS2554: Expected 0-1 arguments, but got 2. f7(""); // ok (function takes an any param) ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(a: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): () => number', gave the following error. !!! error TS2769: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. !!! error TS2769: Overload 2 of 4, '(a: number): number', gave the following error. !!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 3 of 4, '(a?: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }', gave the following error. !!! error TS2769: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. f7(); // ok