angular / angular/components

[MatStepper] FormControlLike is not compatible with FormGroup

Ouverte
#15,859 4 commentaires 15 réactions 0 personnes assignées Voir sur GitHub
area: material/stepper P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Reproduisez le problème de compilation avec Angular Material 7.3.7 et TypeScript en utilisant un MatStepper dont le MatStep stepControl est un FormGroup. Inspectez d’abord le typage de CdkStep/MatStep stepControl ; c’est terminé lorsque les affectations et les casts de FormGroup et FormArray se compilent sans les erreurs signalées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.