angular / angular/components

MatDialog `open` method `R` generic is too loose

Open
#12,898 6 comments 3 reactions 0 assignees View on GitHub
area: material/dialog P4 refactoring
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

Because the `R` generic on `MatDialog.open` isn't constrained by arguments to the function, it's effectively always `any`. 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.

Contributor guide

Open the contributing guide

Research direction

Start by locating the MatDialog.open method declaration and inspect how its R generic is defined and returned. Update the generic typing as described, then verify that dialog result consumers must explicitly provide their intended type and that existing TypeScript checks still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.