angular / angular/components

[MatStepper] FormControlLike is not compatible with FormGroup

Aperta
#15,859 4 commenti 15 reazioni 0 assegnatari Vedi su GitHub
area: material/stepper P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il problema di compilazione con Angular Material 7.3.7 e TypeScript usando un MatStepper il cui MatStep stepControl è un FormGroup. Esamina prima la tipizzazione di CdkStep/MatStep stepControl; il lavoro è completato quando le assegnazioni e i cast di FormGroup e FormArray vengono compilati senza gli errori segnalati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.