tests/cases/compiler/functionsWithImplicitReturnTypeAssignableToUndefined.ts(22,16): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
tests/cases/compiler/functionsWithImplicitReturnTypeAssignableToUndefined.ts(28,16): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
tests/cases/compiler/functionsWithImplicitReturnTypeAssignableToUndefined.ts(35,16): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
tests/cases/compiler/functionsWithImplicitReturnTypeAssignableToUndefined.ts(41,16): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.


==== tests/cases/compiler/functionsWithImplicitReturnTypeAssignableToUndefined.ts (4 errors) ====
    function f1(): unknown {
        if (Math.random() < 0.5) return true;
    
        // Implicit return, but undefined is always assignable to unknown.
    }
    
    type MyUnknown = unknown;
    function f2(): unknown {
        if (Math.random() < 0.5) return true;
    
        // Implicit return, but undefined is always assignable to unknown.
    }
    
    function f3(): any {
        // Implicit return, but undefined is always assignable to any.
    }
    
    function f4(): void {
        // Implicit return, but undefined is always assignable to void.
    }
    
    function f5(): {} {
                   ~~
!!! error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
        if (Math.random() < 0.5) return {};
    
        // Implicit return, but undefined is assignable to object when strictNullChecks is off.
    }
    
    function f6(): Record<string, any> {
                   ~~~~~~~~~~~~~~~~~~~
!!! error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
        if (Math.random() < 0.5) return { "foo": true };
    
        // Implicit return, but undefined is assignable to records (which are just fancy objects)
        // when strictNullChecks is off.
    }
    
    function f7(): null {
                   ~~~~
!!! error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
        if (Math.random() < 0.5) return null;
    
        // Implicit return, but undefined is assignable to null when strictNullChecks is off.
    }
    
    function f8(): string | null {
                   ~~~~~~~~~~~~~
!!! error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
        if (Math.random() < 0.5) return "foo";
    
        // Implicit return, but undefined is assignable to null when strictNullChecks is off.
    }