Improve types to match reality (#10691)
This commit is contained in:
parent
ba796504f5
commit
96c8267f71
2 changed files with 5 additions and 5 deletions
|
@ -75,7 +75,7 @@ export default abstract class BasePlatform {
|
||||||
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract getConfig(): Promise<IConfigOptions>;
|
public abstract getConfig(): Promise<IConfigOptions | undefined>;
|
||||||
|
|
||||||
public abstract getDefaultDeviceDisplayName(): string;
|
public abstract getDefaultDeviceDisplayName(): string;
|
||||||
|
|
||||||
|
|
|
@ -189,12 +189,12 @@ export default class AutoDiscoveryUtils {
|
||||||
* @returns {Promise<ValidatedServerConfig>} Resolves to the validated configuration.
|
* @returns {Promise<ValidatedServerConfig>} Resolves to the validated configuration.
|
||||||
*/
|
*/
|
||||||
public static buildValidatedConfigFromDiscovery(
|
public static buildValidatedConfigFromDiscovery(
|
||||||
serverName: string,
|
serverName?: string,
|
||||||
discoveryResult: ClientConfig,
|
discoveryResult?: ClientConfig,
|
||||||
syntaxOnly = false,
|
syntaxOnly = false,
|
||||||
isSynthetic = false,
|
isSynthetic = false,
|
||||||
): ValidatedServerConfig {
|
): ValidatedServerConfig {
|
||||||
if (!discoveryResult || !discoveryResult["m.homeserver"]) {
|
if (!discoveryResult?.["m.homeserver"]) {
|
||||||
// This shouldn't happen without major misconfiguration, so we'll log a bit of information
|
// This shouldn't happen without major misconfiguration, so we'll log a bit of information
|
||||||
// in the log so we can find this bit of code but otherwise tell the user "it broke".
|
// in the log so we can find this bit of code but otherwise tell the user "it broke".
|
||||||
logger.error("Ended up in a state of not knowing which homeserver to connect to.");
|
logger.error("Ended up in a state of not knowing which homeserver to connect to.");
|
||||||
|
@ -249,7 +249,7 @@ export default class AutoDiscoveryUtils {
|
||||||
throw new UserFriendlyError("Unexpected error resolving homeserver configuration");
|
throw new UserFriendlyError("Unexpected error resolving homeserver configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
let preferredHomeserverName = serverName ? serverName : hsResult["server_name"];
|
let preferredHomeserverName = serverName ?? hsResult["server_name"];
|
||||||
|
|
||||||
const url = new URL(preferredHomeserverUrl);
|
const url = new URL(preferredHomeserverUrl);
|
||||||
if (!preferredHomeserverName) preferredHomeserverName = url.hostname;
|
if (!preferredHomeserverName) preferredHomeserverName = url.hostname;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue