Skip to content

Implement an abstract class that contains protected abstract methods #32292

@Shinigami92

Description

@Shinigami92

Code

export abstract class MyLifecycleHook {
   protected abstract aMethod(a: number, b: string): void | Promise<void>;
}

export default class MyClassA implements MyLifecycleHook {
   protected aMethod(a: number, b: string): void | Promise<void> {
      // Code
   }
}

export default class MyClassB implements MyLifecycleHook {
   public aMethod(a: number, b: string): void | Promise<void> {
      // Code
   }
}

Playground

Expected behavior:
It should be protectable.
Alternative: It should at least be made publicable.

Actual behavior:

Property 'aMethod' is protected but type 'MyClassA' is not a class derived from 'MyLifecycleHook'.

Related Issues:
#25163

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions