Apply strictNullChecks to src/components/views/dialogs/devtools/* (#10391)

This commit is contained in:
Kerry 2023-03-17 12:58:41 +13:00 committed by GitHub
parent 5211b628d6
commit b2c046689e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 26 deletions

View file

@ -1,5 +1,6 @@
/*
Copyright 2022 Michael Telatynski <7t3chguy@gmail.com>
Copyright 2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -29,7 +30,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> => {
await cli.setAccountData(eventType, content);
await cli.setAccountData(eventType, content || {});
};
const defaultContent = mxEvent ? stringify(mxEvent.getContent()) : undefined;
@ -43,7 +44,7 @@ export const RoomAccountDataEventEditor: React.FC<IEditorProps> = ({ mxEvent, on
const fields = useMemo(() => [eventTypeField(mxEvent?.getType())], [mxEvent]);
const onSend = async ([eventType]: string[], content?: IContent): Promise<void> => {
await cli.setRoomAccountData(context.room.roomId, eventType, content);
await cli.setRoomAccountData(context.room.roomId, eventType, content || {});
};
const defaultContent = mxEvent ? stringify(mxEvent.getContent()) : undefined;
@ -58,7 +59,7 @@ interface IProps extends IDevtoolsProps {
const BaseAccountDataExplorer: React.FC<IProps> = ({ events, Editor, actionLabel, onBack, setTool }) => {
const [query, setQuery] = useState("");
const [event, setEvent] = useState<MatrixEvent>(null);
const [event, setEvent] = useState<MatrixEvent | null>(null);
if (event) {
const onBack = (): void => {