Make more code conform to strict null checks (#10219
* Make more code conform to strict null checks * Fix types * Fix tests * Fix remaining test assertions * Iterate PR
This commit is contained in:
parent
4c79ecf141
commit
76b82b4b2b
130 changed files with 603 additions and 603 deletions
|
@ -56,7 +56,7 @@ export const createSpace = async (
|
|||
avatar?: string | File,
|
||||
createOpts: Partial<ICreateRoomOpts> = {},
|
||||
otherOpts: Partial<Omit<ICreateOpts, "createOpts">> = {},
|
||||
): Promise<string> => {
|
||||
): Promise<string | null> => {
|
||||
return createRoom({
|
||||
createOpts: {
|
||||
name,
|
||||
|
@ -179,7 +179,7 @@ export const SpaceCreateForm: React.FC<ISpaceCreateFormProps> = ({
|
|||
children,
|
||||
}) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
const domain = cli.getDomain();
|
||||
const domain = cli.getDomain() ?? undefined;
|
||||
|
||||
const onKeyDown = (ev: KeyboardEvent): void => {
|
||||
const action = getKeyBindingsManager().getAccessibilityAction(ev);
|
||||
|
@ -231,7 +231,7 @@ export const SpaceCreateForm: React.FC<ISpaceCreateFormProps> = ({
|
|||
name="spaceTopic"
|
||||
element="textarea"
|
||||
label={_t("Description")}
|
||||
value={topic}
|
||||
value={topic ?? ""}
|
||||
onChange={(ev) => setTopic(ev.target.value)}
|
||||
rows={3}
|
||||
disabled={busy}
|
||||
|
@ -261,14 +261,18 @@ const SpaceCreateMenu: React.FC<{
|
|||
|
||||
setBusy(true);
|
||||
// require & validate the space name field
|
||||
if (!(await spaceNameField.current.validate({ allowEmpty: false }))) {
|
||||
if (spaceNameField.current && !(await spaceNameField.current.validate({ allowEmpty: false }))) {
|
||||
spaceNameField.current.focus();
|
||||
spaceNameField.current.validate({ allowEmpty: false, focused: true });
|
||||
setBusy(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (visibility === Visibility.Public && !(await spaceAliasField.current.validate({ allowEmpty: false }))) {
|
||||
if (
|
||||
spaceAliasField.current &&
|
||||
visibility === Visibility.Public &&
|
||||
!(await spaceAliasField.current.validate({ allowEmpty: false }))
|
||||
) {
|
||||
spaceAliasField.current.focus();
|
||||
spaceAliasField.current.validate({ allowEmpty: false, focused: true });
|
||||
setBusy(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue