Improve types for sendEvent
(#12335)
This commit is contained in:
parent
4941327c78
commit
ef2bd7ae04
26 changed files with 209 additions and 99 deletions
|
@ -28,6 +28,7 @@ import {
|
|||
LocationAssetType,
|
||||
M_TIMESTAMP,
|
||||
M_BEACON,
|
||||
TimelineEvents,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||
|
||||
|
@ -80,10 +81,10 @@ interface IProps {
|
|||
onFinished(): void;
|
||||
}
|
||||
|
||||
interface IEntryProps {
|
||||
interface IEntryProps<K extends keyof TimelineEvents> {
|
||||
room: Room;
|
||||
type: EventType | string;
|
||||
content: IContent;
|
||||
type: K;
|
||||
content: TimelineEvents[K];
|
||||
matrixClient: MatrixClient;
|
||||
onFinished(success: boolean): void;
|
||||
}
|
||||
|
@ -95,7 +96,7 @@ enum SendState {
|
|||
Failed,
|
||||
}
|
||||
|
||||
const Entry: React.FC<IEntryProps> = ({ room, type, content, matrixClient: cli, onFinished }) => {
|
||||
const Entry: React.FC<IEntryProps<any>> = ({ room, type, content, matrixClient: cli, onFinished }) => {
|
||||
const [sendState, setSendState] = useState<SendState>(SendState.CanSend);
|
||||
const [onFocus, isActive, ref] = useRovingTabIndex<HTMLDivElement>();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue