mirror of
https://github.com/github/codeql-action.git
synced 2026-12-02 03:42:01 +08:00
Rename type to better match generic intention
This commit is contained in:
1 parent
b222c3aaea
commit
40f80a8df0
2 files changed
+11
-9
No files matched your search
Generated
+2
-2
@@ -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 */]);
|
||||
}
|
||||
|
||||
@@ -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" &&
|
||||
|
||||
Reference in new issue
Block a user