-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Description
Bug, feature request, or proposal:
feature request
What is the expected behavior?
MatDialogRef.afterClosed()
return Observable
of a type other than any
.
What is the current behavior?
MatDialogRef.afterClosed()
returns Observable<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:
export interface DialogComponent<R> { }
export interface TypedMatDialogRef<T extends DialogComponent<R>, R> extends MatDialogRef<T> {
afterClosed(): Observable<R>;
}
export interface TypedMatDialog extends MatDialog {
open<T extends DialogComponent<R>, R, D = any>(componentOrTemplateRef: ComponentType<T>, config?: MatDialogConfig<D>): TypedMatDialogRef<T, R>;
}
@Component({})
export class MyDialogComponent implements DialogComponent<string> { }
(this.dialog as TypedMatDialog).open(MyDialogComponent)
.afterClosed()
.subscribe(string => {/* string is showing as {}*/});
Not sure why this doesn't work.
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent