Refactor isVersionInfo() to use json` module

This commit is contained in:
Mario Campos
2026-06-16 17:17:10 -05:00
parent 445107e23a
commit 587fcb33c7
+9 -9
View File
@@ -634,16 +634,16 @@ interface PersistedVersionInfo {
} }
function isVersionInfo(x: unknown): x is VersionInfo { function isVersionInfo(x: unknown): x is VersionInfo {
const candidate = x as Partial<VersionInfo> | null;
return ( return (
typeof candidate === "object" && json.isObject(x) &&
candidate !== null && json.validateSchema(
typeof candidate.version === "string" && {
(candidate.features === undefined || version: json.string,
(typeof candidate.features === "object" && features: json.undefinable(json.object),
candidate.features !== null)) && overlayVersion: json.undefinable(json.number),
(candidate.overlayVersion === undefined || },
typeof candidate.overlayVersion === "number") x,
)
); );
} }