Skip to content

bug(MatStep): MatStep.isErrorState should accept AbstractControl instead of UntypedFormControl #25103

@migmigmig

Description

@migmigmig

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I'm going through the process of activating strict template typechecking.

Our legacy code sends FormControlGroup instances into isErrorState. Unfortunately, the compiler won't accept a FormControlGroup instance for an UntypedFormControl.

However, the underlying ErrorStateMatcher accepts AbstractControl. And everything has seemed fine (for years) with passing a group here.

As a secondary item, it would be great if methods that take " | null " as part of their parameter types would also allow those params to be optional?

Thanks!

Reproduction

Steps to reproduce:

  1. Pass a FormControlGroup instance as the first param to MatStep.isErrorState()

Expected Behavior

Compiler happily accepts FormControlGroup.

Actual Behavior

Compiler complains that FormControlGroup doesn't match UntypedFormControl.

Environment

  • Angular:
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

Metadata

Metadata

Assignees

Labels

GThis is is related to a Google internal issueP3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/stepperformsThis issue is related to Angular Forms integration

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions