-
Notifications
You must be signed in to change notification settings - Fork 285
fix: replace StreamChatGenerics with module augmentation #2634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0a39de2
to
93b9d95
Compare
const options: ChannelOptions = { state: true, presence: true, limit: 10 }; | ||
const sort: ChannelSort = { last_message_at: -1, updated_at: -1 }; | ||
|
||
type LocalAttachmentType = Record<string, unknown>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've yet to see a more beautiful sight than this :D
c5728f7
to
36c3dc3
Compare
Size Change: -218 B (-0.02%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## rc #2634 +/- ##
==========================================
- Coverage 81.14% 81.05% -0.09%
==========================================
Files 469 469
Lines 9939 9908 -31
Branches 2411 2410 -1
==========================================
- Hits 8065 8031 -34
+ Misses 1494 1492 -2
- Partials 380 385 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c9d1e66
to
3349707
Compare
export type StreamMessage = | ||
// FIXME: we should use only one of the two (either formatted or unformatted) | ||
(ReturnType<StreamChannelState['formatMessage']> | MessageResponse) & { | ||
customType?: string; | ||
errorStatusCode?: number; | ||
error?: ErrorFromResponse<APIErrorResponse>; | ||
editing?: boolean; | ||
date?: Date; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revisit StreamMessage
and decide what its shape should be as of a "local" message. In my opinion we should treat it as FormattedMessageResponse
with some extra properties (lines 31-35), which we sometimes add.
73f23f0
to
7d0a418
Compare
7d0a418
to
4660d30
Compare
|
||
const isMessageAIGenerated = (message: StreamMessage<StreamChatGenerics>) => | ||
!!message?.ai_generated; | ||
const isMessageAIGenerated = (message: StreamMessage) => !!message?.ai_generated; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, perhaps the typescript
compiler is malfunctioning here for some reason - this should be complaining here unless we extend the CustomMessageData
interface to include the field; curious as to why it's not ?
4660d30
to
21e9925
Compare
74449b1
to
239997c
Compare
## [13.0.0-rc.1](v12.14.0...v13.0.0-rc.1) (2025-04-28) ### ⚠ BREAKING CHANGES * `Channel` props `dragAndDropWindow` & `optionalMessageInputProps` have been removed, use * Remove ChatAutoComplete, AutoCompleteTextarea, DefaultSuggestionList, DefaultSuggestionListItem and introduce TextareaComposer, SuggestionList, SuggestionListItem * Remove defaultScrollToItem function previously used by SuggestionList * Removed DefaultTriggerProvider component * Remove from Channel props - acceptedFiles, enrichURLForPreview, enrichURLForPreviewConfig, maxNumberOfFiles, multipleUploads, TriggerProvider * Removal of acceptedFiles, debounceURLEnrichmentMs, enrichURLForPreview, findURLFn, multipleUploads, onLinkPreviewDismissed, quotedMessage from ChannelStateContext * Changed signature for functions sendMessage and editMessage in ChannelActionContext * Changed signature for handleSubmit * Removed setQuotedMessage from ChannelActionContext * Removed types MessageToSend, StreamMessage, UpdatedMessage in favor of LocalMessage or RenderedMessage * Removed Trigger generics from ChannelProps * Message input state as well as the API is now kept within MessageComposer instead of MessageInputContext * Renamed useMessageInputState to useMessageInputControls as it does not handle the composition state anymore * Removed from MessageInputProps - disabled, disableMentions, doFileUploadRequest, doImageUploadRequest, errorHandler, getDefaultValue, mentionAllAppUsers, mentionQueryParams, message, noFiles, urlEnrichmentConfig, useMentionsTransliteration, additionalTextareaProps do not expect default value anymore * Changed the signature of MessageInput prop overrideSubmitHandler * Local attachment and link preview types moved to stream-chat * The SuggestionListItem UI components for TextareaComposer receive tokenizedDisplayName instead of itemNameParts * Removed duplicate types SendMessageOptions, UpdateMessageOptions which should be imported from stream-chat instead * Removed type LinkPreviewListProps - LinkPreviewList does not have any props anymore * dropped `StreamChatGenerics`, use `Custom<Entity>Data` to extend your types ### Bug Fixes * replace StreamChatGenerics with module augmentation ([#2634](#2634)) ([67bed79](67bed79)) ### Features * default data interfaces ([#2683](#2683)) ([a88e145](a88e145)) * introduce WithDragAndDropUpload component ([#2688](#2688)) ([6b03abd](6b03abd)) * message composer ([#2669](#2669)) ([fa2519b](fa2519b)), closes [#2688](#2688) ### Chores * **deps:** upgrade @stream-io/stream-chat-css to v5.8.1 ([#2689](#2689)) ([d0c32e3](d0c32e3)) ### Refactors * simplify WithDragAndDropUpload API ([#2691](#2691)) ([46c9add](46c9add))
🎉 This PR is included in version 13.0.0-rc.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎯 Goal
References: GetStream/stream-chat-js#1458
Notable changes:
EventComponentProps.message
property with{ event?: Event }
to cover for weird edge-caseStreamMessage
type with these properties commonly used across the SDK{ customType?: string; errorStatusCode?: number; editing?: boolean; date?: Date }
BREAKING CHANGE: dropped
StreamChatGenerics
, useCustom<Entity>Data
to extend your types