PreviewGroup declarations fail strict type checking with TS2430 in 1.10.1

Đang mở Phù hợp với người mới
#541 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Issue nêu khai báo đã phát hành @rc-component/[email protected] PreviewGroup.d.ts và cung cấp một ví dụ tái hiện tối giản bằng TypeScript với chế độ strict. Cài đặt các dependency được liệt kê và chạy lệnh npx tsc để xác nhận TS2430, sau đó kiểm tra các khai báo cấu hình preview dùng chung và của group. Hoàn tất khi kiểm tra strict thành công và các callback của group vẫn có thể dùng info.current như một số.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
211
Fork
128
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của react-component/image

Tất cả issue của react-component/image

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.