Hello,
Our app is written in TypeScript. We are running a very old version of your SDK (3.0.98). We are trying to upgrade to the latest (3.0.137). In that processes we have found that we need to update some types. Where ever we use a message type filter, we would use the values of 0, 1, 2, 3 to represent all, user(message), file, admin respectively.
I didn’t find any official SendBird enum that could be used as value for this.
The closes thing I could find was in your Types File (SendBird.d.s) I have seen something like
interface UserMessage extends BaseMessageInstance {
messageType: ‘user’;
…
}
That does not seem to match what is needed by:
interface PreviousMessageListQuery {
…
messageTypeFilter: 0 | 1 | 2 | 3; // 0: ALL, 1: USER, 2: FILE, 3: ADMIN
…
}
Am I doing something wrong or do your types need updating? If PreviousMessageListQuery does need updating I can propose a PR that may help here.
Thank you
Do you have any code snippet to have a better understanding? Thanks.
The excerpts from above were taken from the SendBird.d.ts file. It is the type definitions themselves.
Let me try to explain this differently
If I do:
this.messageListQuery = this.channel?.createPreviousMessageListQuery();
this.messageListQuery.messageTypeFilter = MessageType.MESG // This throws an error. Expects 0 | 1 | 2 | 3 //
this.messageListQuery.load((messages, error) => ...); // This fails
if I do
this.messageListQuery = this.channel?.createPreviousMessageListQuery();
this.messageListQuery.messageTypeFilter = 1 // then this works.
this.messageListQuery.load((messages, error) => ...); // This succeeds
What is the relationship between MessageTypeFilter not the same thing as MessageType?
To put this another way:
interface PreviousMessageListQuery {
hasMore: boolean;
isLoading: boolean;
limit: number;
reverse: boolean;
messageTypeFilter: 0 | 1 | 2 | 3; // <<---- I think this is wrong and should be something like 'MESG' | 'FILE' | 'ADMM'
customTypeFilter: string;
senderUserIdsFilter: Array<string>;
includeMetaArray: boolean;
includeReaction: boolean; // DEPRECATED
includeReactions: boolean;
includeReplies: boolean;
includeParentMessageText: boolean;
includeThreadInfo: boolean;
showSubchannelMessagesOnly: boolean;
load(limit: number, reverse: boolean, callback: messageListCallback): void;
load(limit: number, reverse: boolean, messageType: number, callback: messageListCallback): void;
load(callback: messageListCallback): void;
}
So that calls to following do not fail:
this.messageListQuery.load()