-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
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
whzx5byb
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript