ModuleWithExportedAndNonExportedFunctions.ts(8,9): error TS2322: Type 'null' is not assignable to type 'U'.
  'U' could be instantiated with an arbitrary type which could be unrelated to 'null'.
ModuleWithExportedAndNonExportedFunctions.ts(16,9): error TS2322: Type 'null' is not assignable to type 'U'.
  'U' could be instantiated with an arbitrary type which could be unrelated to 'null'.
ModuleWithExportedAndNonExportedFunctions.ts(28,13): error TS2339: Property 'fn2' does not exist on type 'typeof A'.
ModuleWithExportedAndNonExportedFunctions.ts(29,14): error TS2551: Property 'fng2' does not exist on type 'typeof A'. Did you mean 'fng'?


==== ModuleWithExportedAndNonExportedFunctions.ts (4 errors) ====
    namespace A {
    
        export function fn(s: string) {
            return true;
        }
    
        export function fng<T, U>(s: T): U {
            return null;
            ~~~~~~
!!! error TS2322: Type 'null' is not assignable to type 'U'.
!!! error TS2322:   'U' could be instantiated with an arbitrary type which could be unrelated to 'null'.
        }
    
        function fn2(s: string) {
            return false;
        }
    
        function fng2<T, U>(s: T): U {
            return null;
            ~~~~~~
!!! error TS2322: Type 'null' is not assignable to type 'U'.
!!! error TS2322:   'U' could be instantiated with an arbitrary type which could be unrelated to 'null'.
        }
    }
    
    // these should not be errors since the functions are exported
    var fn: (s: string) => boolean;
    var fn = A.fn;
    
    var fng: <T, U>(s: T) => U;
    var fng = A.fng; // bug 838015
    
    // these should be errors since the functions are not exported
    var fn2 = A.fn2;
                ~~~
!!! error TS2339: Property 'fn2' does not exist on type 'typeof A'.
    var fng2 = A.fng2;
                 ~~~~
!!! error TS2551: Property 'fng2' does not exist on type 'typeof A'. Did you mean 'fng'?
!!! related TS2728 ModuleWithExportedAndNonExportedFunctions.ts:7:21: 'fng' is declared here.