Files
tsgo/testdata/baselines/reference/submodule/conformance/memberFunctionsWithPrivateOverloads.js

72 lines
1.7 KiB
TypeScript

//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts] ////
//// [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) { }
}
declare var c: C;
var r = c.foo(1); // error
declare var d: D<number>;
var r2 = d.foo(2); // error
var r3 = C.foo(1); // error
var r4 = D.bar(''); // error
//// [memberFunctionsWithPrivateOverloads.js]
"use strict";
class C {
foo(x, y) { }
bar(x, y) { }
static foo(x, y) { }
static bar(x, y) { }
}
class D {
foo(x, y) { }
bar(x, y) { }
static foo(x, y) { }
static bar(x, y) { }
}
var r = c.foo(1); // error
var r2 = d.foo(2); // error
var r3 = C.foo(1); // error
var r4 = D.bar(''); // error