-
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
MatDialog open
method R
generic is too loose
#12898
Comments
The reason |
The issue is not with 'any', but with allowing
It looks like any other code where the function call returned some type, but the developer choose to write it out for clarity. By forcing the developer to write |
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
Removes the `R` generic, because it always ends up as `any` in the result subscriptions. Fixes angular#12898.
It would be nice if the type of |
The only type safe thing would be if the dialog and it's return value would be passed around. |
Whilst I'm not entirely certain if the best default should be -export declare class MatDialogRef<T, R = any> {
+export declare class MatDialogRef<T, R = void> { |
Also check out a proposed workaround for a similar type issue #24538 (comment). |
Because the
R
generic onMatDialog.open
isn't constrained by arguments to the function, it's effectively alwaysany
. We should remove the method generic and change the return generic to{}
, which will force people to explicitly state which type it is when consuming it.The text was updated successfully, but these errors were encountered: