Accessing protected computed property does not produce a compiler errorΒ #60974
Open
Description
π Search Terms
protected computed no error bug
π Version & Regression Information
This is the behavior in every version I tried (v3.3.3333, v4.0.5, v5.7.3), and I reviewed the FAQ for entries about Common "Bugs" That Aren't Bugs
β― Playground Link
π» Code
declare class Foo {
protected readonly baz = 42
}
declare class Bar {
readonly foo: Foo
}
declare const bar: Bar
// @ts-expect-error
console.log(bar.foo["baz"].toFixed(2))
π Actual behavior
- (without
// @ts-expect-error
): No errors - (with
// @ts-expect-error
): Compiler errorUnused '@ts-expect-error' directive
π Expected behavior
- (without
// @ts-expect-error
): Compiler errorProperty [β¦] is protected and only accessible within class 'Foo' and its subclasses
- (with
// @ts-expect-error
): No errors
Additional information about the issue
No response