While immersing myself in learning Angular, a TypeScript-based framework, I encountered an intriguing error:
The class 'SnackbarService' is mistakenly extending the base class 'MatSnackBar'. There are separate declarations for types of a private property '_overlay'.
This error revealed itself as I attempted to extend MatSnackBar
from @angular/material
.
Here's the snippet of my code causing this issue:
import { MatSnackBar } from '@angular/material';
import { Overlay } from '@angular/cdk/overlay';
import { LiveAnnouncer } from '@angular/cdk/a11y';
...
export class SnackbarService extends MatSnackBar {
constructor(
private _overlay: Overlay,
private _liveAnnouncer: LiveAnnouncer,
...
) {
super(_overlay, _liveAnnouncer, ...);
}
}
}
I would greatly appreciate any assistance or insights on why this is happening. Thank you!