Rename type to better match generic intention

This commit is contained in:
Mario Campos committed 2026-08-11 18:09:09 -05:00
1 parent b222c3aaea
commit 40f80a8df0
2 files changed
+11 -9

No files matched your search

+2 -2
View File
@@ -146278,7 +146278,7 @@ function getCachedCodeQlVersion(cmd, env = getEnv()) {
} catch {
return void 0;
}
if (!isPersistedVersionInfo(persisted) || cmd !== void 0 && persisted.cmd !== cmd) {
if (!isCommandCacheRecord(persisted) || cmd !== void 0 && persisted.cmd !== cmd) {
return void 0;
}
cachedCodeQlVersion = persisted.entries["version" /* Version */];
@@ -146288,7 +146288,7 @@ function isVersionInfo(x) {
const candidate = x;
return typeof candidate === "object" && candidate !== null && typeof candidate.version === "string" && (candidate.features === void 0 || typeof candidate.features === "object" && candidate.features !== null) && (candidate.overlayVersion === void 0 || typeof candidate.overlayVersion === "number");
}
function isPersistedVersionInfo(x) {
function isCommandCacheRecord(x) {
const candidate = x;
return typeof candidate === "object" && candidate !== null && typeof candidate.cmd === "string" && candidate.entries !== void 0 && isVersionInfo(candidate.entries["version" /* Version */]);
}
+9 -7
View File
@@ -20,8 +20,10 @@ type CommandCacheKeyOutputMap = {
[CommandCacheKey.Version]: VersionInfo;
};
/** The persisted version together with the CLI path it was obtained from. */
interface PersistedVersionInfo<K extends CommandCacheKey> {
/**
* The type of the command cache that is persisted to disk.
*/
interface CommandCacheRecord<K extends CommandCacheKey> {
cmd: string;
entries: Map<K, CommandCacheKeyOutputMap[K]>;
}
@@ -107,7 +109,7 @@ export function getCachedCodeQlVersion(
return undefined;
}
if (
!isPersistedVersionInfo(persisted) ||
!isCommandCacheRecord(persisted) ||
(cmd !== undefined && persisted.cmd !== cmd)
) {
return undefined;
@@ -137,14 +139,14 @@ function isVersionInfo(x: unknown): x is VersionInfo {
}
/**
* Determines whether a value is a `PersistedVersionInfo` object.
* Determines whether a value is a `CommandCacheRecord` object.
* @param x The value to test
*/
function isPersistedVersionInfo(
function isCommandCacheRecord(
x: unknown,
): x is PersistedVersionInfo<CommandCacheKey.Version> {
): x is CommandCacheRecord<CommandCacheKey.Version> {
const candidate = x as Partial<
PersistedVersionInfo<CommandCacheKey.Version>
CommandCacheRecord<CommandCacheKey.Version>
> | null;
return (
typeof candidate === "object" &&