Skip to content

Commit 0d1755d

Browse files
GeorgianStanamysorto
authored andcommitted
fix(material/snack-bar): update generic types for openFromComponent (#24634)
* fix(material/snack-bar): update generic types for openFromComponent Add a generic for MatSnackBarConfig inside openFromComponent method * fix(material/snack-bar): Update the generic from openFromComponent for public_api_guard (cherry picked from commit 9243266)
1 parent aae6083 commit 0d1755d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/material/snack-bar/snack-bar.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ export abstract class _MatSnackBarBase implements OnDestroy {
9292
* @param component Component to be instantiated.
9393
* @param config Extra configuration for the snack bar.
9494
*/
95-
openFromComponent<T>(component: ComponentType<T>, config?: MatSnackBarConfig): MatSnackBarRef<T> {
95+
openFromComponent<T, D = any>(
96+
component: ComponentType<T>,
97+
config?: MatSnackBarConfig<D>,
98+
): MatSnackBarRef<T> {
9699
return this._attach(component, config) as MatSnackBarRef<T>;
97100
}
98101

tools/public_api_guard/material/snack-bar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export abstract class _MatSnackBarBase implements OnDestroy {
7878
open(message: string, action?: string, config?: MatSnackBarConfig): MatSnackBarRef<TextOnlySnackBar>;
7979
get _openedSnackBarRef(): MatSnackBarRef<any> | null;
8080
set _openedSnackBarRef(value: MatSnackBarRef<any> | null);
81-
openFromComponent<T>(component: ComponentType<T>, config?: MatSnackBarConfig): MatSnackBarRef<T>;
81+
openFromComponent<T, D = any>(component: ComponentType<T>, config?: MatSnackBarConfig<D>): MatSnackBarRef<T>;
8282
openFromTemplate(template: TemplateRef<any>, config?: MatSnackBarConfig): MatSnackBarRef<EmbeddedViewRef<any>>;
8383
protected abstract simpleSnackBarComponent: Type<TextOnlySnackBar>;
8484
protected abstract snackBarContainerComponent: Type<_SnackBarContainer>;

0 commit comments

Comments
 (0)