From 587fcb33c738fe65109c7fbcda01b693e9b9614a Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Tue, 16 Jun 2026 17:17:10 -0500 Subject: [PATCH] Refactor `isVersionInfo()`` to use `json` module --- src/util.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/util.ts b/src/util.ts index a7833b2df..3bf0c0d61 100644 --- a/src/util.ts +++ b/src/util.ts @@ -634,16 +634,16 @@ interface PersistedVersionInfo { } function isVersionInfo(x: unknown): x is VersionInfo { - const candidate = x as Partial | null; return ( - typeof candidate === "object" && - candidate !== null && - typeof candidate.version === "string" && - (candidate.features === undefined || - (typeof candidate.features === "object" && - candidate.features !== null)) && - (candidate.overlayVersion === undefined || - typeof candidate.overlayVersion === "number") + json.isObject(x) && + json.validateSchema( + { + version: json.string, + features: json.undefinable(json.object), + overlayVersion: json.undefinable(json.number), + }, + x, + ) ); }