mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-27 03:37:27 -07:00
Refactor: Eliminate no-unsafe-return suppressions via strict type validation (#20668)
Signed-off-by: M-DEV-1 <mahadevankizhakkedathu@gmail.com> Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
@@ -111,18 +111,20 @@ function resolveEnvVarsInObjectInternal<T>(
|
||||
// Check for circular reference
|
||||
if (visited.has(obj)) {
|
||||
// Return a shallow copy to break the cycle
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
return [...obj] as unknown as T;
|
||||
const copy: unknown = [...obj];
|
||||
const isTArray = (val: unknown): val is T => Array.isArray(val);
|
||||
if (isTArray(copy)) return copy;
|
||||
throw new Error('Unreachable');
|
||||
}
|
||||
|
||||
visited.add(obj);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
const result = obj.map((item) =>
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
const mapped: unknown = obj.map((item: unknown) =>
|
||||
resolveEnvVarsInObjectInternal(item, visited, customEnv),
|
||||
) as unknown as T;
|
||||
);
|
||||
visited.delete(obj);
|
||||
return result;
|
||||
const isTArray = (val: unknown): val is T => Array.isArray(val);
|
||||
if (isTArray(mapped)) return mapped;
|
||||
throw new Error('Unreachable');
|
||||
}
|
||||
|
||||
if (typeof obj === 'object') {
|
||||
|
||||
Reference in New Issue
Block a user