-
Notifications
You must be signed in to change notification settings - Fork 79
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
fix!: replace StreamChatGenerics with module augmentation #1458
base: master
Are you sure you want to change the base?
Conversation
Size Change: -632 B (-0.12%) Total Size: 523 kB
|
src/types.ts
Outdated
|
||
export interface CustomAttachmentType {} | ||
export interface CustomChannelType {} | ||
export interface CustomCommandType {} |
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.
Might have to figure out a better way for this to work. Currently using keyof CustomCommandType
to make it work with interface merging.
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.
This right here: https://github.com/GetStream/stream-chat-js/pull/1458/files#diff-c54113cf61ec99691748a3890bfbeb00e10efb3f0a76f03a0fd9ec49072e410aR2124
Actual module augmentation would have to look something like:
// file.d.ts
import 'stream-chat';
declare module 'stream-chat' {
interface CustomCommandType {
customCommand: unknown;
otherCustomCommand: 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.
Looks good ! We're already doing similar things for other parts of the RN SDK (extending functionality and overloads) so this will come natural.
The entire change is breaking I assume, right ? What's the strategy to go about merging this when the time comes ? I suppose all SDKs would need to bump their major versions if they wish to upgrade their version of stream-chat
. Although kind of large in size, the change seems easy to do (if generics were being used in the first place).
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.
Yes, in case of React SDK we'd be releasing v13.0.0 which will bump its stream-chat
peer to v9.0.0 - the peer of the SDK is currently bound to v8-something.
As for the migration - see this draft of a migration guide here, feel free to suggest enhancements. Not sure where it'll live yet, I assume both React and RN will be similar in terms of migration but I'm open to adding tabs to switch between RN and React.
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.
That's fair - in that case we should pick it up earlier rather than later since stream-chat
is a direct dependency for stream-chat-react-native
(and not a peer one).
Since we'll likely have to do a V7 to go along with it as well, maybe we can do the same ? it should get rid of our pesky TS errors when there's a version mismatch (despite the fact it's a direct dependency).
fyi @oliverlaz
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.
@isekovanic I agree!
We should have a similar guide, and also we need to update the following chapters:
9765037
to
ad95891
Compare
const updateKey = key as keyof typeof _user; | ||
|
||
if (updateKey in event.user) { | ||
// @ts-expect-error it has an issue with this, not sure why |
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.
😬
ad95891
to
fe6b938
Compare
fe6b938
to
709bbb5
Compare
efe8430
to
8a87f88
Compare
ca04832
to
9ae0456
Compare
9ae0456
to
f486ff3
Compare
Description of the changes, What, Why and How?
BREAKING CHANGES:
StreamChatGenerics
, useCustom<InterfaceKey>
to extend your typesInviteOptions
has been renamed toUpdateChannelOptions
UpdateChannelOptions
has been renamed toUpdateChannelTypeOptions
ThreadResponseCustomData
has been renamed toCustomThreadData
MarkAllReadOptions
has been deleted in favour of typeMarkChannelsReadOptions
QueryFilter
no longer supports$ne
and$nin
operatorsChannelMembership
has been deleted in favour of typeChannelMemberResponse
formatMessage
(utils.ts
) no longer returns__html
property in the formatted message outputFIXES:
channel_role
has been removed from the type of themembers
parameter of theChannel.inviteMembers
method