I’m using Sendbird v3.1.10 in a React application with TypeScript.
I’m trying to create a channel with user Ids by calling createChannelWithUserIds()
.
The Type Definitions say that a possible syntax is
createChannelWithUserIds(
userIds: Array<string>,
isDistinct: boolean,
name: string,
coverUrlOrImageFile: string | FileType,
data: string,
customType: string,
callback?: groupChannelCallback // notice that this can be undefined
): Promise<GroupChannel>;
However any call I make without specifying a callback
throws a SendBirdException: Invalid parameter
, which is not a very informative error - took me a while to understand which was the parameter that was causing the issue.
This doesn’t work:
sb.GroupChannel.createChannelWithUserIds(userIds, false, channelName, "", "", "") // no callback
This doesn’t work:
sb.GroupChannel.createChannelWithUserIds(userIds, false, channelName, "", "", "", undefined) // undefined callback
This works:
sb.GroupChannel.createChannelWithUserIds(userIds, false, channelName, "", "", "", (c) => {})
Can you make it so that the callback
parameter is really optional as the type definitions say?
It would also be cool if all other parameters but the userIds
were also optional so that we don’t have to set them as empty strings in order for it to work, that’s just silly.
Thanks!