Conform more of the codebase to strictNullChecks (#10800)

This commit is contained in:
Michael Telatynski 2023-05-10 08:41:55 +01:00 committed by GitHub
parent adb29b38a3
commit 456c66db5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 147 additions and 123 deletions

View file

@ -44,7 +44,7 @@ interface IState {
export default class ServerPickerDialog extends React.PureComponent<IProps, IState> {
private readonly defaultServer: ValidatedServerConfig;
private readonly fieldRef = createRef<Field>();
private validatedConf: ValidatedServerConfig;
private validatedConf?: ValidatedServerConfig;
public constructor(props: IProps) {
super(props);
@ -85,7 +85,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
// find their homeserver without demanding they use "https://matrix.org"
private validate = withValidation<this, { error?: string }>({
deriveData: async ({ value }): Promise<{ error?: string }> => {
let hsUrl = value.trim(); // trim to account for random whitespace
let hsUrl = (value ?? "").trim(); // trim to account for random whitespace
// if the URL has no protocol, try validate it as a serverName via well-known
if (!hsUrl.includes("://")) {