You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classFoo{privatebar=1;}letfoo=newFoo();foo.bar;// type errorfoo['bar'];// can access private property
Although prefer-dot-notation disallows element access where possible, but there are still property names like 'foo-bar' that need to use element access. TypeScript intentionally doesn't check accessibility on element access for reasons ... (see microsoft/TypeScript#26328)
This is likely an error and should be detected by a lint rule
The text was updated successfully, but these errors were encountered:
It turns out there are a lot more checks that are simply ignored for element access:
super['abstractMethod']
super['prop']
this['abstractProp'] in constructor
a['protectedProp']: accessing protected property declared in base class on an instance of a base class in a static method of a derived class (or a function with a this parameter of a derived class)
Although
prefer-dot-notation
disallows element access where possible, but there are still property names like'foo-bar'
that need to use element access. TypeScript intentionally doesn't check accessibility on element access for reasons ... (see microsoft/TypeScript#26328)This is likely an error and should be detected by a lint rule
The text was updated successfully, but these errors were encountered: