Use mapped types around account data events (#28752)
* Use mapped types around account data events --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
baaed75c4b
commit
be181d2c79
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import React, { useContext, useMemo, useState } from "react";
|
||||
import { IContent, MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { AccountDataEvents, IContent, MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import BaseTool, { DevtoolsContext, IDevtoolsProps } from "./BaseTool";
|
||||
import MatrixClientContext from "../../../../contexts/MatrixClientContext";
|
||||
@@ -21,7 +21,7 @@ export const AccountDataEventEditor: React.FC<IEditorProps> = ({ mxEvent, onBack
|
||||
|
||||
const fields = useMemo(() => [eventTypeField(mxEvent?.getType())], [mxEvent]);
|
||||
|
||||
const onSend = async ([eventType]: string[], content?: IContent): Promise<void> => {
|
||||
const onSend = async ([eventType]: Array<keyof AccountDataEvents>, content?: IContent): Promise<void> => {
|
||||
await cli.setAccountData(eventType, content || {});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user