swc/crates/swc_ecma_parser/tests/tsc/subtypingWithObjectMembersAccessibility2.ts

61 lines
881 B
TypeScript
Raw Normal View History

// Derived member is private, base member is not causes errors
class Base {
foo: string;
}
class Derived extends Base {
bar: string;
}
module ExplicitPublic {
class A {
private foo: Base;
}
class B extends A {
public foo: Derived; // error
}
class A2 {
private 1: Base;
}
class B2 extends A2 {
public 1: Derived; // error
}
class A3 {
private '1': Base;
}
class B3 extends A3 {
public '1': Derived; // error
}
}
module ImplicitPublic {
class A {
private foo: Base;
}
class B extends A {
foo: Derived; // error
}
class A2 {
private 1: Base;
}
class B2 extends A2 {
1: Derived; // error
}
class A3 {
private '1': Base;
}
class B3 extends A3 {
'1': Derived; // error
}
}