mirror of
https://github.com/swc-project/swc.git
synced 2024-12-03 00:54:25 +03:00
36 lines
585 B
TypeScript
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
|
|
}
|