mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 11:11:30 +03:00
35 lines
506 B
TypeScript
35 lines
506 B
TypeScript
// @declaration: true
|
|
|
|
class Foo {
|
|
constructor(public x: number) { }
|
|
}
|
|
|
|
class Bar {
|
|
public constructor(public x: number) { }
|
|
}
|
|
|
|
class Baz {
|
|
protected constructor(public x: number) { }
|
|
}
|
|
|
|
class Qux {
|
|
private constructor(public x: number) { }
|
|
}
|
|
|
|
// b is public
|
|
let a = Foo;
|
|
a = Bar;
|
|
a = Baz; // error Baz is protected
|
|
a = Qux; // error Qux is private
|
|
|
|
// b is protected
|
|
let b = Baz;
|
|
b = Foo;
|
|
b = Bar;
|
|
b = Qux; // error Qux is private
|
|
|
|
// c is private
|
|
let c = Qux;
|
|
c = Foo;
|
|
c = Bar;
|
|
c = Baz; |