PreviewGroup declarations fail strict type checking with TS2430 in 1.10.1

オープン 初心者向け
#541 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

Issue では公開済みの宣言 @rc-component/[email protected] PreviewGroup.d.ts を挙げ、TypeScript の strict モードでの最小再現例を提示しています。記載された依存関係をインストールし、npx tsc コマンドを実行して TS2430 を確認してから、グループと共有 preview config の宣言を調べてください。strict チェックが通り、グループのコールバックで引き続き info.current を数値として使える状態になれば完了です。

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

説明

PR #529 proposes a fix for this error. Here is a minimal reproduction using the published npm package.

Reproduction

In an empty directory:

npm init -y
npm install @rc-component/[email protected] react@18 react-dom@18
npm install -D [email protected] @types/[email protected] @types/react-dom@18
echo "import '@rc-component/image/es/PreviewGroup';" > index.ts
npx tsc --noEmit --strict --skipLibCheck false --target es2020 --module esnext --moduleResolution bundler index.ts
Actual result
PreviewGroup.d.ts(6,18): error TS2430: Interface 'GroupPreviewConfig' incorrectly extends interface 'InternalPreviewConfig'.
  Types of property 'imageRender' are incompatible.

The shared callback accepts info.current?: number, while the group callback requires info.current: number. The same error also reproduces with @types/[email protected].

Expected result

The published declarations should pass strict checking, and group callbacks should still be able to use info.current as a number.

主要言語
TypeScript
スター
211
フォーク
128
平均マージ
2日 23時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

react-component/image のほかの issue

react-component/image の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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