[v2]: make fieldComponents less strict to allow grouping

オープン
#2,360 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
frontend

調査の方向性

まず、v2 fieldComponents の型定義と既存のコンポーネント構造用の型を見つけます。ネストされたグループ化オブジェクトがどのように検証されるかを確認し、グループ化されたエントリが受け入れられる一方で、最終的なリーフエントリが引き続きコンポーネントとして扱われることを確認します。該当する型テストがあれば更新し、なければ追加します。

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

説明

area: types scope: react type: enhancement v2

One thing we still can't do in v2 is attach groupings to our form fields. Like we have <field.Layout.Row> and <field.Layout.Stack> but we can't just add bare objects to fieldComponents on type level so we now make them a component that doesn't do anything and then attach Row and Stack to it:

export function Layout() {
  return null;
}

Layout.Row = ...
Layout.Stack = ...

It works at runtime, I think it's just a type mismatch that fieldComponents expects things that return jsx, but I think it would be great if we could add groups like this:

fieldComponents: {
  Layout: {
    Row, Stack
  }
}

as long as the last thing is a component..

主要言語
TypeScript
スター
6.8k
フォーク
717
平均マージ
5日 22時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/form のほかの issue

TanStack/form の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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