@@ -63,7 +63,7 @@ export class MatSnackBar implements OnDestroy {
6363 * If there is a parent snack-bar service, all operations should delegate to that parent
6464 * via `_openedSnackBarRef`.
6565 */
66- private _snackBarRefAtThisLevel : MatSnackBarRef < any > | null = null ;
66+ private _snackBarRefAtThisLevel : MatSnackBarRef < unknown > | null = null ;
6767
6868 /** The component that should be rendered as the snack bar's simple component. */
6969 simpleSnackBarComponent = SimpleSnackBar ;
@@ -75,12 +75,12 @@ export class MatSnackBar implements OnDestroy {
7575 handsetCssClass = 'mat-mdc-snack-bar-handset' ;
7676
7777 /** Reference to the currently opened snackbar at *any* level. */
78- get _openedSnackBarRef ( ) : MatSnackBarRef < any > | null {
78+ get _openedSnackBarRef ( ) : MatSnackBarRef < unknown > | null {
7979 const parent = this . _parentSnackBar ;
8080 return parent ? parent . _openedSnackBarRef : this . _snackBarRefAtThisLevel ;
8181 }
8282
83- set _openedSnackBarRef ( value : MatSnackBarRef < any > | null ) {
83+ set _openedSnackBarRef ( value : MatSnackBarRef < unknown > | null ) {
8484 if ( this . _parentSnackBar ) {
8585 this . _parentSnackBar . _openedSnackBarRef = value ;
8686 } else {
@@ -98,11 +98,11 @@ export class MatSnackBar implements OnDestroy {
9898 * @param component Component to be instantiated.
9999 * @param config Extra configuration for the snack bar.
100100 */
101- openFromComponent < T , D = any > (
101+ openFromComponent < T , D = unknown > (
102102 component : ComponentType < T > ,
103103 config ?: MatSnackBarConfig < D > ,
104104 ) : MatSnackBarRef < T > {
105- return this . _attach ( component , config ) as MatSnackBarRef < T > ;
105+ return this . _attach ( component , config ) ;
106106 }
107107
108108 /**
@@ -113,9 +113,9 @@ export class MatSnackBar implements OnDestroy {
113113 * @param config Extra configuration for the snack bar.
114114 */
115115 openFromTemplate (
116- template : TemplateRef < any > ,
116+ template : TemplateRef < unknown > ,
117117 config ?: MatSnackBarConfig ,
118- ) : MatSnackBarRef < EmbeddedViewRef < any > > {
118+ ) : MatSnackBarRef < EmbeddedViewRef < unknown > > {
119119 return this . _attach ( template , config ) ;
120120 }
121121
@@ -187,14 +187,19 @@ export class MatSnackBar implements OnDestroy {
187187 /**
188188 * Places a new component or a template as the content of the snack bar container.
189189 */
190+ private _attach < T > ( content : ComponentType < T > , userConfig ?: MatSnackBarConfig ) : MatSnackBarRef < T > ;
191+ private _attach < T > (
192+ content : TemplateRef < T > ,
193+ userConfig ?: MatSnackBarConfig ,
194+ ) : MatSnackBarRef < EmbeddedViewRef < T > > ;
190195 private _attach < T > (
191196 content : ComponentType < T > | TemplateRef < T > ,
192197 userConfig ?: MatSnackBarConfig ,
193- ) : MatSnackBarRef < T | EmbeddedViewRef < any > > {
198+ ) : MatSnackBarRef < T | EmbeddedViewRef < unknown > > {
194199 const config = { ...new MatSnackBarConfig ( ) , ...this . _defaultConfig , ...userConfig } ;
195200 const overlayRef = this . _createOverlay ( config ) ;
196201 const container = this . _attachSnackBarContainer ( overlayRef , config ) ;
197- const snackBarRef = new MatSnackBarRef < T | EmbeddedViewRef < any > > ( container , overlayRef ) ;
202+ const snackBarRef = new MatSnackBarRef < T | EmbeddedViewRef < unknown > > ( container , overlayRef ) ;
198203
199204 if ( content instanceof TemplateRef ) {
200205 const portal = new TemplatePortal ( content , null ! , {
@@ -231,11 +236,11 @@ export class MatSnackBar implements OnDestroy {
231236
232237 this . _animateSnackBar ( snackBarRef , config ) ;
233238 this . _openedSnackBarRef = snackBarRef ;
234- return this . _openedSnackBarRef ;
239+ return snackBarRef ;
235240 }
236241
237242 /** Animates the old snack bar out and the new one in. */
238- private _animateSnackBar ( snackBarRef : MatSnackBarRef < any > , config : MatSnackBarConfig ) {
243+ private _animateSnackBar ( snackBarRef : MatSnackBarRef < unknown > , config : MatSnackBarConfig ) {
239244 // When the snackbar is dismissed, clear the reference to it.
240245 snackBarRef . afterDismissed ( ) . subscribe ( ( ) => {
241246 // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar.
0 commit comments