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

36 lines
585 B
TypeScript

// @declaration: true
class C {
public constructor(public x: number) { }
}
class D {
private constructor(public x: number) { }
}
class E {
protected constructor(public x: number) { }
}
var c = new C(1);
var d = new D(1); // error
var e = new E(1); // error
module Generic {
class C<T> {
public constructor(public x: T) { }
}
class D<T> {
private constructor(public x: T) { }
}
class E<T> {
protected constructor(public x: T) { }
}
var c = new C(1);
var d = new D(1); // error
var e = new E(1); // error
}