66 lines
No EOL
2.3 KiB
Text
66 lines
No EOL
2.3 KiB
Text
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts (10 errors) ====
|
|
class C {
|
|
private foo(x: number);
|
|
public foo(x: number, y: string); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private foo(x: any, y?: any) { }
|
|
|
|
private bar(x: 'hi');
|
|
public bar(x: string); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private bar(x: number, y: string);
|
|
private bar(x: any, y?: any) { }
|
|
|
|
private static foo(x: number);
|
|
public static foo(x: number, y: string); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private static foo(x: any, y?: any) { }
|
|
|
|
private static bar(x: 'hi');
|
|
public static bar(x: string); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private static bar(x: number, y: string);
|
|
private static bar(x: any, y?: any) { }
|
|
}
|
|
|
|
class D<T> {
|
|
private foo(x: number);
|
|
public foo(x: T, y: T); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private foo(x: any, y?: any) { }
|
|
|
|
private bar(x: 'hi');
|
|
public bar(x: string); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private bar(x: T, y: T);
|
|
private bar(x: any, y?: any) { }
|
|
|
|
private static foo(x: number);
|
|
public static foo(x: number, y: string); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private static foo(x: any, y?: any) { }
|
|
|
|
private static bar(x: 'hi');
|
|
public static bar(x: string); // error
|
|
~~~
|
|
!!! Overload signatures must all be public or private.
|
|
private static bar(x: number, y: string);
|
|
private static bar(x: any, y?: any) { }
|
|
}
|
|
|
|
var c: C;
|
|
var r = c.foo(1); // error
|
|
~~~~~
|
|
!!! Property 'C.foo' is inaccessible.
|
|
|
|
var d: D<number>;
|
|
var r2 = d.foo(2); // error
|
|
~~~~~
|
|
!!! Property 'D.foo' is inaccessible. |