Having some difficulty utilizing the external module augmentations feature merged in #6213. Here is a test case to demonstrate the problem:
// a.ts
export class A {
protected protected: any;
public setProtected(val: any) {
this.protected = val;
}
}
// b.ts
import {A} from './a'; // Only here to make b.ts an external module
declare module "./a" {
interface A { }
}
This results in the following error:
a.ts(5,9): error TS2446: Property 'protected' is protected and only accessible through an instance of class 'A'.
It looks like the problem is that checkClassPropertyAccess in checker.ts ends up obtaining the merged interface as the enclosing class of the property access, rather than the actual enclosing class, then tries to ensure that this interface is derived from the class which declares the property, which isn't the case.
Having some difficulty utilizing the external module augmentations feature merged in #6213. Here is a test case to demonstrate the problem:
This results in the following error:
It looks like the problem is that
checkClassPropertyAccessin checker.ts ends up obtaining the merged interface as the enclosing class of the property access, rather than the actual enclosing class, then tries to ensure that this interface is derived from the class which declares the property, which isn't the case.