swc/crates/swc_ecma_parser/tests/tsc/privateNamesAndkeyof.ts
2022-02-04 17:08:38 +09:00

24 lines
427 B
TypeScript

// @strict: true
// @target: es6
class A {
#fooField = 3;
#fooMethod() { };
get #fooProp() { return 1; };
set #fooProp(value: number) { };
bar = 3;
baz = 3;
}
// `keyof A` should not include '#foo*'
let k: keyof A = "bar"; // OK
k = "baz"; // OK
k = "#fooField"; // Error
k = "#fooMethod"; // Error
k = "#fooProp"; // Error
k = "fooField"; // Error
k = "fooMethod"; // Error
k = "fooProp"; // Error