-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(dialog): improved type safety in dialog ref result #8766
Conversation
8dab3e6
to
13709dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/lib/dialog/dialog-ref.ts
Outdated
@@ -101,14 +101,14 @@ export class MatDialogRef<T> { | |||
/** | |||
* Gets an observable that is notified when the dialog is finished closing. | |||
*/ | |||
afterClosed(): Observable<any> { | |||
afterClosed(): Observable<R> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the return type here be Observable<R | undefined>
since the dialogResult
parameter in the close
method is optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'm not sure why TS didn't complain about it.
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.
13709dd
to
e23b154
Compare
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.
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. |
Adds an extra generic param to the
MatDialogRef
that allows consumers to type the result that is passed toclose
, as well as the value in thebeforeClosed
andafterClosed
observables.Fixes #8760.