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

32 lines
410 B
TypeScript
Raw Normal View History

class C {
y: number;
constructor(y: number) { } // ok
}
var c: C;
var r = c.y;
class D {
y: number;
constructor(public y: number) { } // error
}
var d: D;
var r2 = d.y;
class E {
y: number;
constructor(private y: number) { } // error
}
var e: E;
var r3 = e.y; // error
class F {
y: number;
constructor(protected y: number) { } // error
}
var f: F;
var r4 = f.y; // error