Suppress wrong typeguard warnings

This commit is contained in:
baldo 2022-05-26 13:03:46 +02:00
parent a81dc30f0a
commit 4c77f9f5ab

View file

@ -44,6 +44,7 @@ export function isNodeStatistics(arg: unknown): arg is NodeStatistics {
return false; return false;
} }
const stats = arg as NodeStatistics; const stats = arg as NodeStatistics;
// noinspection SuspiciousTypeOfGuard
return ( return (
typeof stats.registered === "number" && typeof stats.registered === "number" &&
typeof stats.withVPN === "number" && typeof stats.withVPN === "number" &&
@ -77,6 +78,7 @@ export function isCommunityConfig(arg: unknown): arg is CommunityConfig {
return false; return false;
} }
const cfg = arg as CommunityConfig; const cfg = arg as CommunityConfig;
// noinspection SuspiciousTypeOfGuard
return ( return (
typeof cfg.name === "string" && typeof cfg.name === "string" &&
typeof cfg.domain === "string" && typeof cfg.domain === "string" &&
@ -98,6 +100,7 @@ export function isLegalConfig(arg: unknown): arg is LegalConfig {
return false; return false;
} }
const cfg = arg as LegalConfig; const cfg = arg as LegalConfig;
// noinspection SuspiciousTypeOfGuard
return ( return (
(cfg.privacyUrl === undefined || typeof cfg.privacyUrl === "string") && (cfg.privacyUrl === undefined || typeof cfg.privacyUrl === "string") &&
(cfg.imprintUrl === undefined || typeof cfg.imprintUrl === "string") (cfg.imprintUrl === undefined || typeof cfg.imprintUrl === "string")
@ -115,6 +118,7 @@ export function isClientMapConfig(arg: unknown): arg is ClientMapConfig {
return false; return false;
} }
const cfg = arg as ClientMapConfig; const cfg = arg as ClientMapConfig;
// noinspection SuspiciousTypeOfGuard
return typeof cfg.mapUrl === "string"; return typeof cfg.mapUrl === "string";
} }
@ -129,6 +133,7 @@ export function isMonitoringConfig(arg: unknown): arg is MonitoringConfig {
return false; return false;
} }
const cfg = arg as MonitoringConfig; const cfg = arg as MonitoringConfig;
// noinspection SuspiciousTypeOfGuard
return typeof cfg.enabled === "boolean"; return typeof cfg.enabled === "boolean";
} }
@ -144,6 +149,7 @@ export function isCoords(arg: unknown): arg is Coords {
return false; return false;
} }
const coords = arg as Coords; const coords = arg as Coords;
// noinspection SuspiciousTypeOfGuard
return ( return (
typeof coords.lat === "number" && typeof coords.lat === "number" &&
typeof coords.lng === "number" typeof coords.lng === "number"
@ -164,6 +170,7 @@ export function isCoordsSelectorConfig(arg: unknown): arg is CoordsSelectorConfi
return false; return false;
} }
const cfg = arg as CoordsSelectorConfig; const cfg = arg as CoordsSelectorConfig;
// noinspection SuspiciousTypeOfGuard
return ( return (
typeof cfg.lat === "number" && typeof cfg.lat === "number" &&
typeof cfg.lng === "number" && typeof cfg.lng === "number" &&
@ -185,6 +192,7 @@ export function isOtherCommunityInfoConfig(arg: unknown): arg is OtherCommunityI
return false; return false;
} }
const cfg = arg as OtherCommunityInfoConfig; const cfg = arg as OtherCommunityInfoConfig;
// noinspection SuspiciousTypeOfGuard
return ( return (
typeof cfg.showInfo === "boolean" && typeof cfg.showInfo === "boolean" &&
typeof cfg.showBorderForDebugging === "boolean" && typeof cfg.showBorderForDebugging === "boolean" &&
@ -210,6 +218,7 @@ export function isClientConfig(arg: unknown): arg is ClientConfig {
return false; return false;
} }
const cfg = arg as ClientConfig; const cfg = arg as ClientConfig;
// noinspection SuspiciousTypeOfGuard
return ( return (
isCommunityConfig(cfg.community) && isCommunityConfig(cfg.community) &&
isLegalConfig(cfg.legal) && isLegalConfig(cfg.legal) &&