TypeScript/tests/cases/conformance/classes/members/privateNames/privateNamesAndIndexedAccess.ts
2020-01-08 15:15:20 -08:00

15 lines
394 B
TypeScript

// @strict: true
// @target: es6
// @strictPropertyInitialization: false
class C {
foo = 3;
#bar = 3;
constructor () {
const ok: C["foo"] = 3;
// not supported yet, could support in future:
const badForNow: C[#bar] = 3; // Error
// will never use this syntax, already taken:
const badAlways: C["#bar"] = 3; // Error
}
}