Skip to content

fix: clean up ComponentOverrides types to not leak displayName#3551

Merged
oliverlaz merged 3 commits intodevelopfrom
fix/component-overrides-type-cleanup
Apr 15, 2026
Merged

fix: clean up ComponentOverrides types to not leak displayName#3551
oliverlaz merged 3 commits intodevelopfrom
fix/component-overrides-type-cleanup

Conversation

@oliverlaz
Copy link
Copy Markdown
Member

🎯 Goal

Components with .displayName assignments (e.g. ChannelPreviewView.displayName = '...') caused typeof to include displayName: string (required) in the inferred DEFAULT_COMPONENTS type. This leaked into ComponentOverrides, forcing integrators to set displayName on their custom component overrides.

🛠 Implementation details

  • NormalizeComponents mapped type — normalizes each entry in DEFAULT_COMPONENTS to React.ComponentType<P>, where displayName is optional (displayName?: string). Applied via a typed cast on the export so the raw object keeps its runtime shape.
  • OptionalComponentOverrides interface — optional component slots (no default implementation) are moved out of the runtime object into a standalone interface. This eliminates undefined as React.ComponentType<any> | undefined casts and eslint-disable comments.
  • Proper props typesMessageLocation, MessageText, and Input now have real prop types instead of React.ComponentType<any>. Components rendered with no props use React.ComponentType (defaults to {}).
  • Removed stale PLAN.md from the componentsContext directory.

🎨 UI Changes

No UI changes — types only.

🧪 Testing

  • npx tsc --noEmit passes with zero errors
  • Verified via TS compiler API that ChannelPreview on DEFAULT_COMPONENTS resolves to ComponentType<...> with ?displayName: string | undefined (optional)

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

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
@Stream-SDK-Bot
Copy link
Copy Markdown
Contributor

Stream-SDK-Bot commented Apr 15, 2026

SDK Size

title develop branch diff status
js_bundle_size 354 KB 354 KB 0 B 🟢

@oliverlaz oliverlaz merged commit 96b3cd3 into develop Apr 15, 2026
5 checks passed
@oliverlaz oliverlaz deleted the fix/component-overrides-type-cleanup branch April 15, 2026 16:51
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.

3 participants