Conform more of the codebase to strict types (#11191)
This commit is contained in:
parent
4044c2aa66
commit
8107f1d271
25 changed files with 88 additions and 57 deletions
|
@ -92,7 +92,7 @@ export default class LazyRenderList<T = any> extends React.Component<IProps<T>,
|
|||
this.state = LazyRenderList.getDerivedStateFromProps(props, {} as IState) as IState;
|
||||
}
|
||||
|
||||
public static getDerivedStateFromProps(props: IProps<unknown>, state: IState): Partial<IState> | null {
|
||||
public static getDerivedStateFromProps<T>(props: IProps<T>, state: IState): Partial<IState> | null {
|
||||
const range = LazyRenderList.getVisibleRangeFromProps(props);
|
||||
const intersectRange = range.expand(props.overflowMargin);
|
||||
const renderRange = range.expand(props.overflowItems);
|
||||
|
@ -105,7 +105,7 @@ export default class LazyRenderList<T = any> extends React.Component<IProps<T>,
|
|||
return null;
|
||||
}
|
||||
|
||||
private static getVisibleRangeFromProps(props: IProps<unknown>): ItemRange {
|
||||
private static getVisibleRangeFromProps<T>(props: IProps<T>): ItemRange {
|
||||
const { items, itemHeight, scrollTop, height } = props;
|
||||
const length = items ? items.length : 0;
|
||||
const topCount = Math.min(Math.max(0, Math.floor(scrollTop / itemHeight)), length);
|
||||
|
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import React, { createRef, KeyboardEventHandler } from "react";
|
||||
import { MatrixError } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { _t } from "../../../languageHandler";
|
||||
import withValidation, { IFieldState, IValidationResult } from "./Validation";
|
||||
|
@ -209,7 +210,7 @@ export default class RoomAliasField extends React.PureComponent<IProps, IState>
|
|||
// any server error code will do,
|
||||
// either it M_NOT_FOUND or the alias is invalid somehow,
|
||||
// in which case we don't want to show the invalid message
|
||||
return !!err.errcode;
|
||||
return err instanceof MatrixError;
|
||||
}
|
||||
},
|
||||
valid: () => _t("This address is available to use"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue