tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(2,10): error TS7010: 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(3,10): error TS7010: 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(6,5): error TS7010: 'nullWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(10,5): error TS7010: 'underfinedWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. ==== tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts (4 errors) ==== // this should be an error function nullWidenFunction() { return null;} // error at "nullWidenFunction" ~~~~~~~~~~~~~~~~~ !!! error TS7010: 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. function undefinedWidenFunction() { return undefined; } // error at "undefinedWidenFunction" ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS7010: 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. class C { nullWidenFuncOfC() { // error at "nullWidenFuncOfC" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return null; ~~~~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS7010: 'nullWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. underfinedWidenFuncOfC() { // error at "underfinedWidenFuncOfC" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return undefined; ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS7010: 'underfinedWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. } // this should not be an error function foo1(): any { return null; } function bar1(): any { return undefined; } function fooBar(): number { return 1; } function fooFoo() { return 5; } // this should not be an error as the error is raised by expr above nullWidenFunction(); undefinedWidenFunction();