Skip to content

Add FieldRenderProps excess prop type coverage#1089

Open
erikras-richard-agent wants to merge 1 commit intomainfrom
agent/oss-134-gh-990-fieldrenderprops-index-signature
Open

Add FieldRenderProps excess prop type coverage#1089
erikras-richard-agent wants to merge 1 commit intomainfrom
agent/oss-134-gh-990-fieldrenderprops-index-signature

Conversation

@erikras-richard-agent
Copy link
Copy Markdown
Contributor

@erikras-richard-agent erikras-richard-agent commented May 7, 2026

Summary

  • add a TypeScript definitions regression test asserting FieldRenderProps does not allow arbitrary extra props through an index signature
  • covers GH#990; the current declarations already omit the FieldRenderProps index signature, so this locks in the fixed behavior

Fixes #990

Tests

  • yarn nps build
  • yarn nps typescript.definitions
  • yarn nps typescript
  • yarn test

Summary by CodeRabbit

  • Tests
    • Improved TypeScript type-checking coverage for form field rendering properties to enforce proper prop usage and enhance type safety.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ea25299b-7e4a-41f5-8266-ce19cfb72464

📥 Commits

Reviewing files that changed from the base of the PR and between 4271873 and e40046e.

📒 Files selected for processing (1)
  • typescript/Field.test.tsx

📝 Walkthrough

Walkthrough

Added TypeScript type-check tests to typescript/Field.test.tsx verifying that FieldRenderProps does not allow arbitrary extra props. Introduced TextInputProps interface, TextInput component, and a test assertion using @ts-expect-error to confirm TypeScript correctly rejects invalid prop usage.

Changes

FieldRenderProps Type Safety Verification

Layer / File(s) Summary
Type Definition
typescript/Field.test.tsx (lines 35–40)
TextInputProps interface extends FieldRenderProps<string, HTMLInputElement> to create a typed prop shape for a text input component.
Component Implementation
typescript/Field.test.tsx (lines 42–47)
TextInput component is defined as React.FC<TextInputProps>, demonstrating proper usage of FieldRenderProps with required label and input/meta props.
Type Safety Assertion
typescript/Field.test.tsx (lines 49–52)
FieldRenderPropsDoesNotAllowArbitraryProps function uses @ts-expect-error to assert that TypeScript rejects an arbitrary extra prop, confirming the type does not include an index signature.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • erikras

Poem

🐰 Types now dance without the extra fluff,
FieldRenderProps stands steadfast and tough—
No hidden props can slip on through,
TypeScript checks what's false from true! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely describes the primary change: adding TypeScript type coverage to assert FieldRenderProps doesn't allow arbitrary excess props.
Linked Issues check ✅ Passed The PR adds a TypeScript regression test that covers issue #990 by asserting FieldRenderProps rejects excess props, validating the expected behavior that FieldRenderProps should not have an index signature.
Out of Scope Changes check ✅ Passed All changes in the PR are directly related to the objective of adding type coverage for FieldRenderProps excess props, with no unrelated modifications present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/oss-134-gh-990-fieldrenderprops-index-signature

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 and usage tips.

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.

FieldRenderProps type incorrectly includes an index signature

1 participant