Skip to content

Commit

Permalink
chore(dialog): add generic param for config data (#7447)
Browse files Browse the repository at this point in the history
Adds a generic parameter to the `MatDialogConfig` that indicates the type of its `data`.

BREAKING CHANGE: Material now requires at least TypeScript 2.4.

Fixes #4398.
  • Loading branch information
crisbeto authored and andrewseguin committed Oct 12, 2017
1 parent b6f7f17 commit b29ac45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/dialog/dialog-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface DialogPosition {
/**
* Configuration for opening a modal dialog with the MatDialog service.
*/
export class MatDialogConfig {
export class MatDialogConfig<D = any> {

/**
* Where the attached component should live in Angular's *logical* component tree.
Expand Down Expand Up @@ -73,7 +73,7 @@ export class MatDialogConfig {
position?: DialogPosition;

/** Data being injected into the child component. */
data?: any = null;
data?: D | null = null;

/** Layout direction for the dialog's content. */
direction?: Direction = 'ltr';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export class MatDialog {
* @param config Extra configuration options.
* @returns Reference to the newly-opened dialog.
*/
open<T>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
config?: MatDialogConfig): MatDialogRef<T> {
open<T, D = any>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
config?: MatDialogConfig<D>): MatDialogRef<T> {

const inProgressDialog = this.openDialogs.find(dialog => dialog._isAnimating());

Expand Down

0 comments on commit b29ac45

Please sign in to comment.