Skip to content

fix: preserve PreviewGroup imageRender contract - #529

Draft
Cherry7593 wants to merge 1 commit into
react-component:masterfrom
Cherry7593:codex/preview-group-image-render-type
Draft

fix: preserve PreviewGroup imageRender contract#529
Cherry7593 wants to merge 1 commit into
react-component:masterfrom
Cherry7593:codex/preview-group-image-render-type

Conversation

@Cherry7593

Copy link
Copy Markdown

What changed

Make GroupPreviewConfig omit the base imageRender member before redeclaring the grouped callback, and add a runtime regression test for its numeric current value.

Root cause

GroupPreviewConfig extends InternalPreviewConfig, but narrows imageRender from an optional info.current to a required one. Strict TypeScript consumers therefore report TS2430 for the published declaration.

The runtime contracts are genuinely different: single-image rendering may omit current, while PreviewGroup always supplies its active numeric index.

Why this shape

Omit<InternalPreviewConfig, 'imageRender'> preserves all other base members and allows the grouped callback to retain its stronger contract without invalid interface inheritance. Runtime JavaScript is unchanged.

Validation

  • TypeScript 5.9.3 strict consumer with skipLibCheck: false passed
  • upstream TypeScript 6 typecheck passed
  • focused PreviewGroup suite: 17/17 passed
  • complete upstream suite: 8/8 suites, 81/81 tests and 1 snapshot passed
  • lint, Father ESM/CJS/declaration build, Less compile, and package output passed with the separately validated ESLint 10 command compatibility adjustment

The added test verifies imageRender receives current 0 initially and 1 after navigation.

@vercel

vercelBot commented Aug 13, 2026

Copy link
Copy Markdown

@Cherry7593 is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 654a188b-dc93-4926-ae00-1be2d8e9b807

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Cherry7593