angular / angular/components

[MatStepper] FormControlLike is not compatible with FormGroup

オープン
#15,859 コメント 4 件 リアクション 15 件 担当者 0 名 GitHub で見る
area: material/stepper P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

MatStep の stepControl が FormGroup である MatStepper を使用して、Angular Material 7.3.7 と TypeScript のコンパイル問題を再現します。まず CdkStep/MatStep の stepControl の型指定を調査します。FormGroup と FormArray の代入およびキャストが、報告されたエラーなしでコンパイルできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。