Skip to content

fix: change loadAsync return type to React.FC for call-signature bivariance#25064

Draft
dennisoelkers wants to merge 3 commits intomasterfrom
feat/enterprise-plugin-lazy-loading
Draft

fix: change loadAsync return type to React.FC for call-signature bivariance#25064
dennisoelkers wants to merge 3 commits intomasterfrom
feat/enterprise-plugin-lazy-loading

Conversation

@dennisoelkers
Copy link
Copy Markdown
Member

Description

Motivation and Context

ComponentType<T> is invariant in T because its ComponentClass branch uses Readonly<T> in the constructor return type. This broke plugin binding assignments when components were lazy-loaded via loadAsync, since the inferred prop types no longer matched exactly. Returning React.FC<T> instead preserves TypeScript's call-signature bivariance, matching the behavior of direct component imports.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

/nocl No user-facing change.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

dennisoelkers and others added 3 commits February 19, 2026 15:34
…riance

ComponentType<T> is invariant in T because its ComponentClass branch uses
Readonly<T> in the constructor return type. This broke plugin binding
assignments when components were lazy-loaded via loadAsync, since the
inferred prop types no longer matched exactly. Returning React.FC<T>
instead preserves TypeScript's call-signature bivariance, matching the
behavior of direct component imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that loadAsync-wrapped components are assignable to plugin binding slots using ComponentType<T>, including bivariant prop compatibility, ref-bearing props, and unknown prop inference. Also verify that completely incompatible prop types are still rejected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant