diff --git a/src/types.ts b/src/types.ts index 864404023..2a2102470 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1793,13 +1793,17 @@ export type Sort = { [P in keyof T]?: AscDesc; }; +export type SortMember = { + [P in keyof T]?: AscDesc | string[]; +}; + export type UserSort = | Sort> | Array>>; export type MemberSort = - | Sort, 'id' | 'created_at' | 'name'>> - | Array, 'id' | 'created_at' | 'name'>>>; + | SortMember, 'id' | 'created_at' | 'name' | 'channel_role'>> + | Array, 'id' | 'created_at' | 'name' | 'channel_role'>>>; export type SearchMessageSortBase = Sort< StreamChatGenerics['messageType'] diff --git a/src/utils.ts b/src/utils.ts index 3730df582..87d8d73a6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -115,7 +115,7 @@ export function addFileToFormData( return data; } -export function normalizeQuerySort>(sort: T | T[]) { +export function normalizeQuerySort>(sort: T | T[]) { const sortFields: Array<{ direction: AscDesc; field: keyof T }> = []; const sortArr = Array.isArray(sort) ? sort : [sort]; for (const item of sortArr) {