reactjs / reactjs/react.dev

[Suggestion]: Add types to React compiler debugging example

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

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

type: documentation
主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

Summary

Hello I noticed that the examples on the debugging page (https://react.dev/reference/react-compiler/logger#basic-logging) for the compiler don’t include TypeScript types. It might be helpful to add them for the basic example like so

import type { Logger } from 'babel-plugin-react-compiler';

{
...
  logger: {
    logEvent(filename, event) {
      switch (event.kind) {
        case 'CompileSuccess': {
          console.log(`✅ Compiled: ${filename}`);
          break;
        }
        case 'CompileError': {
          console.log(`❌ Skipped: ${filename}`);
          break;
        }
        default: {}
      }
    }
  } satisfies Logger,
...
}

Using satisfies Logger ensures that logEvent(filename, event) is properly typed without needing to manually annotate the parameters.

Cheers

Page

Compiler debugging docs

Details

Adding types would be helpful for IntelliSense and would also help avoid potential errors.

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

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

はじめの一歩

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

調査の方向性

Issue でリンクされている React compiler のデバッグドキュメントにある基本的なロギング例から始めます。提案されている TypeScript の import と Logger の適合を示すように例を更新し、表示された例に型付きの Logger イベントが含まれ、周辺のドキュメントとの整合性が保たれていることを確認します。

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

評価

技術スタック
react, typescript
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
50/100

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

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