Improve types for sendEvent
(#12335)
This commit is contained in:
parent
4941327c78
commit
ef2bd7ae04
26 changed files with 209 additions and 99 deletions
|
@ -16,13 +16,13 @@ limitations under the License.
|
|||
|
||||
import { Composer as ComposerEvent } from "@matrix-org/analytics-events/types/typescript/Composer";
|
||||
import {
|
||||
IContent,
|
||||
IEventRelation,
|
||||
MatrixEvent,
|
||||
ISendEventResponse,
|
||||
MatrixClient,
|
||||
THREAD_RELATION_TYPE,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { RoomMessageEventContent } from "matrix-js-sdk/src/types";
|
||||
|
||||
import { PosthogAnalytics } from "../../../../../PosthogAnalytics";
|
||||
import SettingsStore from "../../../../../settings/SettingsStore";
|
||||
|
@ -82,7 +82,7 @@ export async function sendMessage(
|
|||
}*/
|
||||
PosthogAnalytics.instance.trackEvent<ComposerEvent>(posthogEvent);
|
||||
|
||||
let content: IContent | null = null;
|
||||
let content: RoomMessageEventContent | null = null;
|
||||
|
||||
// Slash command handling here approximates what can be found in SendMessageComposer.sendMessage()
|
||||
// but note that the /me and // special cases are handled by the call to createMessageContent
|
||||
|
@ -145,7 +145,7 @@ export async function sendMessage(
|
|||
|
||||
const prom = doMaybeLocalRoomAction(
|
||||
roomId,
|
||||
(actualRoomId: string) => mxClient.sendMessage(actualRoomId, threadId, content as IContent),
|
||||
(actualRoomId: string) => mxClient.sendMessage(actualRoomId, threadId, content!),
|
||||
mxClient,
|
||||
);
|
||||
|
||||
|
@ -218,7 +218,7 @@ export async function editMessage(
|
|||
this.editorRef.current?.replaceEmoticon(position, REGEX_EMOTICON);
|
||||
}*/
|
||||
const editContent = await createMessageContent(html, true, { editedEvent });
|
||||
const newContent = editContent["m.new_content"];
|
||||
const newContent = editContent["m.new_content"]!;
|
||||
|
||||
const shouldSend = true;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue