tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(17,29): error TS4060: Return type of exported function has or is using private name 'private1'. tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(20,21): error TS4060: Return type of exported function has or is using private name 'private1'. tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(50,31): error TS4060: Return type of exported function has or is using private name 'm2'. tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(53,21): error TS4059: Return type of exported function has or is using name 'm2.public2' from private module 'm2'. ==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts (4 errors) ==== module m { class private1 { } export class public1 { } // Directly using names from this module function foo1(): private1 { return; } function foo2() { return new private1(); } export function foo3(): private1 { ~~~~~~~~ !!! error TS4060: Return type of exported function has or is using private name 'private1'. return; } export function foo4() { ~~~~ !!! error TS4060: Return type of exported function has or is using private name 'private1'. return new private1(); } function foo11(): public1 { return; } function foo12() { return new public1(); } export function foo13(): public1 { return; } export function foo14() { return new public1(); } module m2 { export class public2 { } } function foo111(): m2.public2 { return; } function foo112() { return new m2.public2(); } export function foo113(): m2.public2 { ~~ !!! error TS4060: Return type of exported function has or is using private name 'm2'. return; } export function foo114() { ~~~~~~ !!! error TS4059: Return type of exported function has or is using name 'm2.public2' from private module 'm2'. return new m2.public2(); } }