2014-07-13 01:04:16 +02:00
|
|
|
//// [memberFunctionsWithPrivateOverloads.ts]
|
|
|
|
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
|
|
|
|
|
|
|
|
var d: D<number>;
|
|
|
|
var r2 = d.foo(2); // error
|
|
|
|
|
|
|
|
var r3 = C.foo(1); // error
|
|
|
|
var r4 = D.bar(''); // error
|
|
|
|
|
|
|
|
//// [memberFunctionsWithPrivateOverloads.js]
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
2015-02-07 03:45:09 +01:00
|
|
|
C.prototype.foo = function (x, y) { };
|
|
|
|
C.prototype.bar = function (x, y) { };
|
|
|
|
C.foo = function (x, y) { };
|
|
|
|
C.bar = function (x, y) { };
|
2014-07-13 01:04:16 +02:00
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var D = (function () {
|
|
|
|
function D() {
|
|
|
|
}
|
2015-02-07 03:45:09 +01:00
|
|
|
D.prototype.foo = function (x, y) { };
|
|
|
|
D.prototype.bar = function (x, y) { };
|
|
|
|
D.foo = function (x, y) { };
|
|
|
|
D.bar = function (x, y) { };
|
2014-07-13 01:04:16 +02:00
|
|
|
return D;
|
|
|
|
})();
|
|
|
|
var c;
|
2014-08-15 22:18:54 +02:00
|
|
|
var r = c.foo(1); // error
|
2014-07-13 01:04:16 +02:00
|
|
|
var d;
|
2014-08-15 22:18:54 +02:00
|
|
|
var r2 = d.foo(2); // error
|
|
|
|
var r3 = C.foo(1); // error
|
2014-08-15 23:32:08 +02:00
|
|
|
var r4 = D.bar(''); // error
|