angular / angular/components

[MatStepper] FormControlLike is not compatible with FormGroup

Offen
#15,859 4 Kommentare 15 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/stepper P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### What is the expected behavior?
The stepControl attribute of the CdkStep/MatStep classes should be castable to/assignable from a FormGroup or FormArray.

#### What is the current behavior?
`Conversion of type 'FormControlLike' to type 'FormGroup' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'controls' is missing in type 'FormControlLike'.`
Happens during compilation when trying to cast FormControlLike to a FormGroup.

```Type FormGroup is not assignable to type FormControlLike```
Is the warning shown in HTML files when trying to assign a FormGroup to the stepControl input of a MatStep.

#### What are the steps to reproduce?
Create a MatStepper with a FormGroup assigned to a stepControl of one of the MatSteps. To reproduce the compilation issue, try to cast the stepControl of one step into a FormGroup within a TypeScript function.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Material Version 7.3.7

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere das Kompilierungsproblem mit Angular Material 7.3.7 und TypeScript unter Verwendung eines MatStepper, dessen MatStep stepControl ein FormGroup ist. Untersuche zuerst die Typisierung von CdkStep/MatStep stepControl; erledigt ist die Aufgabe, wenn Zuweisungen und Casts von FormGroup und FormArray ohne die gemeldeten Fehler kompiliert werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.