Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Make MdDialogConfig generic and use type for data property #4398

Closed
epelc opened this issue May 5, 2017 · 2 comments · Fixed by #7447
Closed

Proposal: Make MdDialogConfig generic and use type for data property #4398

epelc opened this issue May 5, 2017 · 2 comments · Fixed by #7447
Assignees

Comments

@epelc
Copy link
Contributor

epelc commented May 5, 2017

Bug, feature request, or proposal:

I propose making MdDialogConfig a generic and use the type for the data property to add better type safety.

See https://github.com/angular/material2/blob/master/src/lib/dialog/dialog-config.ts#L49

Instead of using any you could do

class MdDialogConfig<T> {
  ...
  data?: T;
}

This would give better type safety on the data property.

What is the current behavior?

Data is type any

Which versions of Angular, Material, OS, browsers are affected?

2.0.0-beta.3 cesium-cephalopod (2017-04-07)

@crisbeto
Copy link
Member

crisbeto commented May 5, 2017

This definitely makes sense, however it'll be a breaking change. I think that we should wait until we start supporting TypeScript > 2.3, which introduces default values for generic parameters.

@crisbeto crisbeto self-assigned this May 5, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 30, 2017
Adds a generic parameter to the `MatDialogConfig` that indicates the type of its `data`.

Fixes angular#4398.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 30, 2017
Adds a generic parameter to the `MatDialogConfig` that indicates the type of its `data`.

Fixes angular#4398.
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 11, 2017
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 angular#4398.
andrewseguin pushed a commit that referenced this issue Oct 12, 2017
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.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants