Skip to content

Fix handling of partial / undefined props in React 18 TypeScript#809

Open
joshkel wants to merge 1 commit into
react-grid-layout:masterfrom
joshkel:react-18-partial-types
Open

Fix handling of partial / undefined props in React 18 TypeScript#809
joshkel wants to merge 1 commit into
react-grid-layout:masterfrom
joshkel:react-18-partial-types

Conversation

@joshkel

@joshkel joshkel commented Jun 26, 2026

Copy link
Copy Markdown

And add a test to prevent regressions.

Fixes #807

Summary by CodeRabbit

  • Bug Fixes

    • Improved TypeScript compatibility with React 18 typings, helping catch interface issues earlier and reducing type-related build failures.
    • Adjusted component metadata handling so public typings better reflect optional properties.
  • Chores

    • Added an extra type-check step to the validation workflow for broader coverage during development and CI.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9fe801a0-80d5-4a3f-ad64-00047578dfa3

📥 Commits

Reviewing files that changed from the base of the PR and between a0b6e21 and 6b587ca.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • Makefile
  • lib/Draggable.tsx
  • lib/DraggableCore.tsx
  • package.json
  • typings/tsconfig.react18.json

📝 Walkthrough

Walkthrough

The PR adds a React 18-specific TypeScript typecheck, installs the matching React 18 type package, and changes Draggable and DraggableCore static propTypes declarations to optional while leaving the runtime propTypes objects in place.

Changes

React 18 typing fix

Layer / File(s) Summary
React 18 typecheck setup
package.json, typings/tsconfig.react18.json, Makefile
Adds @types/react-18, a React 18-specific tsconfig, and a lint command that runs tsc with that config.
Optional propTypes declarations
lib/DraggableCore.tsx, lib/Draggable.tsx
Changes both components' static propTypes declarations to optional and updates the surrounding comments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I hop through typings, soft and bright,
With React 18 in rabbit sight.
My propTypes? now twitches free,
And linting sings in harmony.
🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix for React 18 TypeScript prop optionality.
Linked Issues check ✅ Passed The optional propTypes change restores Draggable and DraggableCore prop optionality, matching issue #807's TypeScript fix.
Out of Scope Changes check ✅ Passed The new React 18 typecheck, config, and dependency support the TypeScript fix and are not obviously unrelated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

lib/Draggable.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

lib/DraggableCore.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.


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 free to 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.

Props are marked as required in TypeScript

1 participant