1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(43,11): error TS2341: Property 'foo' is private and only accessible within class 'C'.
tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(46,12): error TS2341: Property 'foo' is private and only accessible within class 'D<T>'.
tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(48,12): error TS2341: Property 'foo' is private and only accessible within class 'C'.
tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(49,12): error TS2341: Property 'bar' is private and only accessible within class 'D<T>'.
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts (4 errors) ====
class C {
private foo(x: number);
private foo(x: number, y: string);
private foo(x: any, y?: any) { }
private bar(x: 'hi');
private bar(x: string);
private bar(x: number, y: string);
private bar(x: any, y?: any) { }
private static foo(x: number);
private static foo(x: number, y: string);
private static foo(x: any, y?: any) { }
private static bar(x: 'hi');
private static bar(x: string);
private static bar(x: number, y: string);
private static bar(x: any, y?: any) { }
}
class D<T> {
private foo(x: number);
private foo(x: T, y: T);
private foo(x: any, y?: any) { }
private bar(x: 'hi');
private bar(x: string);
private bar(x: T, y: T);
private bar(x: any, y?: any) { }
private static foo(x: number);
private static foo(x: number, y: number);
private static foo(x: any, y?: any) { }
private static bar(x: 'hi');
private static bar(x: string);
private static bar(x: number, y: number);
private static bar(x: any, y?: any) { }
}
var c: C;
var r = c.foo(1); // error
~~~
!!! error TS2341: Property 'foo' is private and only accessible within class 'C'.
var d: D<number>;
var r2 = d.foo(2); // error
~~~
!!! error TS2341: Property 'foo' is private and only accessible within class 'D<T>'.
var r3 = C.foo(1); // error
~~~
!!! error TS2341: Property 'foo' is private and only accessible within class 'C'.
var r4 = D.bar(''); // error
~~~
!!! error TS2341: Property 'bar' is private and only accessible within class 'D<T>'.
|