fix: clean up ComponentOverrides types to not leak displayName#3551
Merged
fix: clean up ComponentOverrides types to not leak displayName#3551
Conversation
Components with `.displayName` assignments caused `typeof` to include `displayName: string` (required) in the inferred type, forcing integrators to set it on their overrides. - Add NormalizeComponents mapped type to strip extra inferred properties - Move optional component slots (no default impl) to a typed interface - Replace `React.ComponentType<any>` with proper props types - Remove stale PLAN.md
isekovanic
approved these changes
Apr 15, 2026
Contributor
SDK Size
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Components with
.displayNameassignments (e.g.ChannelPreviewView.displayName = '...') causedtypeofto includedisplayName: string(required) in the inferredDEFAULT_COMPONENTStype. This leaked intoComponentOverrides, forcing integrators to setdisplayNameon their custom component overrides.🛠 Implementation details
NormalizeComponentsmapped type — normalizes each entry inDEFAULT_COMPONENTStoReact.ComponentType<P>, wheredisplayNameis optional (displayName?: string). Applied via a typed cast on the export so the raw object keeps its runtime shape.OptionalComponentOverridesinterface — optional component slots (no default implementation) are moved out of the runtime object into a standalone interface. This eliminatesundefined as React.ComponentType<any> | undefinedcasts andeslint-disablecomments.MessageLocation,MessageText, andInputnow have real prop types instead ofReact.ComponentType<any>. Components rendered with no props useReact.ComponentType(defaults to{}).PLAN.mdfrom the componentsContext directory.🎨 UI Changes
No UI changes — types only.
🧪 Testing
npx tsc --noEmitpasses with zero errorsChannelPreviewonDEFAULT_COMPONENTSresolves toComponentType<...>with?displayName: string | undefined(optional)☑️ Checklist
developbranch