Improve types for sendEvent (#12335)

This commit is contained in:
Michael Telatynski 2024-03-25 12:48:48 +00:00 committed by GitHub
parent 4941327c78
commit ef2bd7ae04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 209 additions and 99 deletions

View file

@ -19,8 +19,9 @@ import type { BLURHASH_FIELD } from "../utils/image-media";
import type { JitsiCallMemberEventType, JitsiCallMemberContent } from "../call-types";
import type { ILayoutStateEvent, WIDGET_LAYOUT_EVENT_TYPE } from "../stores/widgets/types";
import type { VoiceBroadcastInfoEventContent, VoiceBroadcastInfoEventType } from "../voice-broadcast/types";
import type { EncryptedFile } from "matrix-js-sdk/src/types";
// Matrix JS SDK extensions
// Extend Matrix JS SDK types via Typescript declaration merging to support unspecced event fields and types
declare module "matrix-js-sdk/src/types" {
export interface FileInfo {
/**
@ -50,4 +51,35 @@ declare module "matrix-js-sdk/src/types" {
};
"m.room.bot.options": unknown;
}
export interface TimelineEvents {
"io.element.performance_metric": {
"io.element.performance_metrics": {
forEventId: string;
responseTs: number;
kind: "send_time";
};
};
}
export interface AudioContent {
// MSC1767 + Ideals of MSC2516 as MSC3245
// https://github.com/matrix-org/matrix-doc/pull/3245
"org.matrix.msc1767.text"?: string;
"org.matrix.msc1767.file"?: {
url?: string;
file?: EncryptedFile;
name: string;
mimetype: string;
size: number;
};
"org.matrix.msc1767.audio"?: {
duration: number;
// https://github.com/matrix-org/matrix-doc/pull/3246
waveform?: number[];
};
"org.matrix.msc3245.voice"?: {};
"io.element.voice_broadcast_chunk"?: { sequence: number };
}
}