diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -53,7 +53,6 @@ } from '../types/thread-types-enum.js'; import type { SidebarInfo, - LegacyRelativeMemberInfo, MixedRawThreadInfos, RawThreadInfos, } from '../types/thread-types.js'; @@ -352,9 +351,7 @@ relativeMemberInfoSelectorForMembersOfThread(threadID), ( threadInfo: ?RawThreadInfo, - members: $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, - >, + members: $ReadOnlyArray, ): boolean => { if (!threadInfo) { return false; diff --git a/lib/selectors/user-selectors.js b/lib/selectors/user-selectors.js --- a/lib/selectors/user-selectors.js +++ b/lib/selectors/user-selectors.js @@ -18,7 +18,6 @@ import { threadTypes } from '../types/thread-types-enum.js'; import type { LegacyRawThreadInfo, - LegacyRelativeMemberInfo, RawThreadInfos, } from '../types/thread-types.js'; import type { @@ -109,18 +108,16 @@ return relativeMemberInfos; } -const emptyArray: $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, -> = []; +const emptyArray: $ReadOnlyArray = []; // Includes current user at the start const baseRelativeMemberInfoSelectorForMembersOfThread: ( threadID: ?string, ) => ( state: BaseAppState<>, -) => $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, -> = (threadID: ?string) => { +) => $ReadOnlyArray = ( + threadID: ?string, +) => { if (!threadID) { return () => emptyArray; } @@ -137,9 +134,9 @@ threadID: ?string, ) => ( state: BaseAppState<>, -) => $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, -> = _memoize(baseRelativeMemberInfoSelectorForMembersOfThread); +) => $ReadOnlyArray = _memoize( + baseRelativeMemberInfoSelectorForMembersOfThread, +); const userInfoSelectorForPotentialMembers: (state: BaseAppState<>) => { [id: string]: AccountUserInfo, diff --git a/lib/shared/markdown.js b/lib/shared/markdown.js --- a/lib/shared/markdown.js +++ b/lib/shared/markdown.js @@ -12,10 +12,7 @@ MinimallyEncodedRelativeMemberInfo, ResolvedThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { - ChatMentionCandidates, - LegacyRelativeMemberInfo, -} from '../types/thread-types.js'; +import type { ChatMentionCandidates } from '../types/thread-types.js'; // simple-markdown types export type State = { @@ -204,9 +201,7 @@ const useENSNamesOptions = { allAtOnce: true }; function useMemberMapForUserMentions( - members: $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, - >, + members: $ReadOnlyArray, ): $ReadOnlyMap { const membersWithRole = React.useMemo( () => members.filter(member => member.role), @@ -216,7 +211,7 @@ const resolvedMembers = useENSNames(membersWithRole, useENSNamesOptions); const resolvedMembersMap: $ReadOnlyMap< string, - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, + MinimallyEncodedRelativeMemberInfo, > = React.useMemo( () => new Map(resolvedMembers.map(member => [member.id, member])), [resolvedMembers], diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js --- a/lib/shared/mention-utils.js +++ b/lib/shared/mention-utils.js @@ -189,9 +189,7 @@ function useUserMentionsCandidates( threadInfo: ThreadInfo, parentThreadInfo: ?ThreadInfo, -): $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, -> { +): $ReadOnlyArray { return React.useMemo(() => { if (threadInfo.type !== threadTypes.SIDEBAR) { return threadInfo.members; diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -220,18 +220,17 @@ } function threadActualMembers( - memberInfos: $ReadOnlyArray< - MemberInfo | LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, - >, + memberInfos: $ReadOnlyArray, ): $ReadOnlyArray { return memberInfos .filter(memberInfo => memberInfo.role) .map(memberInfo => memberInfo.id); } -function threadOtherMembers< - T: MemberInfo | LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, ->(memberInfos: $ReadOnlyArray, viewerID: ?string): $ReadOnlyArray { +function threadOtherMembers( + memberInfos: $ReadOnlyArray, + viewerID: ?string, +): $ReadOnlyArray { return memberInfos.filter( memberInfo => memberInfo.role && memberInfo.id !== viewerID, ); @@ -461,9 +460,7 @@ // Returns map from lowercase username to AccountUserInfo function memberLowercaseUsernameMap( - members: $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, - >, + members: $ReadOnlyArray, ): Map { const memberMap = new Map(); for (const member of members) { @@ -881,9 +878,8 @@ return firstLine(threadInfo.name); } - const threadMembers: $ReadOnlyArray< - LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, - > = threadInfo.members.filter(memberInfo => memberInfo.role); + const threadMembers: $ReadOnlyArray = + threadInfo.members.filter(memberInfo => memberInfo.role); const memberEntities: $ReadOnlyArray = threadMembers.map(member => ET.user({ userInfo: member }), ); @@ -1036,7 +1032,6 @@ // "parent admin" as anybody with CHANGE_ROLE permissions. function memberHasAdminPowers( memberInfo: - | LegacyRelativeMemberInfo | MinimallyEncodedRelativeMemberInfo | MemberInfo | ServerMemberInfo,