-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Type safe dialog afterClosed() #8760
Comments
Adds an extra generic param to the `MatDialogRef` that allows consumers to type the result that is passed to `close`, as well as the value in the `beforeClosed` and `afterClosed` observables. Fixes angular#8760.
Adds an extra generic param to the `MatDialogRef` that allows consumers to type the result that is passed to `close`, as well as the value in the `beforeClosed` and `afterClosed` observables. Fixes angular#8760.
Adds an extra generic param to the `MatDialogRef` that allows consumers to type the result that is passed to `close`, as well as the value in the `beforeClosed` and `afterClosed` observables. Fixes angular#8760.
Adds an extra generic param to the `MatDialogRef` that allows consumers to type the result that is passed to `close`, as well as the value in the `beforeClosed` and `afterClosed` observables. Fixes #8760.
Will there be an example of how to utilize? |
Adds an extra generic param to the `MatDialogRef` that allows consumers to type the result that is passed to `close`, as well as the value in the `beforeClosed` and `afterClosed` observables. Fixes angular#8760.
@crisbeto @andrewseguin To add to @gatimus I don't see any examples of this in the docs. Could you provide a quick sample here and consider adding something to the docs? |
Here's a quick example of defining the result type: https://stackblitz.com/edit/angular-iw4975?file=app/dialog-overview-example.ts Note that result is typed as string via If you try changing it to |
i would hardly call that a type safe dialog |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
feature request
What is the expected behavior?
MatDialogRef.afterClosed()
returnObservable
of a type other thanany
.What is the current behavior?
MatDialogRef.afterClosed()
returnsObservable<any>
.What is the use-case or motivation for changing an existing behavior?
type safety
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
all
Is there anything else we should know?
I tried:
Not sure why this doesn't work.
The text was updated successfully, but these errors were encountered: