-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Milestone
Description
Bug Report
π Search Terms
class expressions private protected declaration
mixins private protected declaration
π Version & Regression Information:
- This is the behavior in every version I tried 3.3 - 4.2@beta
β― Playground Link
Playground link with relevant code
π» Code
declare function mix<TMix>(mixin: TMix): TMix;
const DisposableMixin = class {
protected _onDispose() {
this._assertIsStripped()
}
private _assertIsStripped() {
}
};
// Expected error since declaration is not representable
// export const DisposableMixinError = mix(DisposableMixin);
// No error, but definition is wrong.
export default mix(DisposableMixin);
export class Monitor extends mix(DisposableMixin) {
protected _onDispose() {
}
}π Actual behavior
Emitted declaration erases private and protected modifiers on DisposableMixin. This actually generates a ts error in the declaration of Monitor on the _onDispose override, since the method has a more restrictive modifier than the emitted declaration for the base class.
declare const _default: {
new (): {
_onDispose(): void;
_assertIsStripped(): void;
};
};
export default _default;
declare const Monitor_base: {
new (): {
_onDispose(): void;
_assertIsStripped(): void;
};
};
export declare class Monitor extends Monitor_base {
protected _onDispose(): void;
}π Expected behavior
An error on the exported private and protected members (like what happens if you uncomment DisposableMixinError ):
Property '_onDispose' of exported class expression may not be private or protected.(4094)
Property '_assertIsStripped' of exported class expression may not be private or protected.(4094)
Note
This issue might be made moot by #41581 in 4.3, or later, depending when declaration emit will be changed to use typeof class
robpalme
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.