refactor: remove redundant browser helper conversions

This commit is contained in:
Peter Steinberger
2026-04-10 21:48:38 +01:00
parent 20849e7196
commit 405a920862
4 changed files with 5 additions and 5 deletions

View File

@@ -691,7 +691,7 @@ export function readBrowserVersion(executablePath: string): string | null {
}
export function parseBrowserMajorVersion(rawVersion: string | null | undefined): number | null {
const matches = [...String(rawVersion ?? "").matchAll(CHROME_VERSION_RE)];
const matches = [...(rawVersion ?? "").matchAll(CHROME_VERSION_RE)];
const match = matches.at(-1);
if (!match?.[1]) {
return null;

View File

@@ -340,7 +340,7 @@ export function buildRoleSnapshotFromAiSnapshot(
aiSnapshot: string,
options: RoleSnapshotOptions = {},
): { snapshot: string; refs: RoleRefMap } {
const lines = String(aiSnapshot ?? "").split("\n");
const lines = aiSnapshot.split("\n");
const refs: RoleRefMap = {};
if (options.interactive) {

View File

@@ -256,7 +256,7 @@ export async function downloadViaPlaywright(opts: {
const timeout = normalizeTimeoutMs(opts.timeoutMs, 120_000);
const ref = requireRef(opts.ref);
const outPath = String(opts.path ?? "").trim();
const outPath = opts.path?.trim() ?? "";
if (!outPath) {
throw new Error("path is required");
}

View File

@@ -99,7 +99,7 @@ export async function storageSetViaPlaywright(opts: {
}): Promise<void> {
const page = await getPageForTargetId(opts);
ensurePageState(page);
const key = String(opts.key ?? "");
const key = opts.key;
if (!key) {
throw new Error("key is required");
}
@@ -108,7 +108,7 @@ export async function storageSetViaPlaywright(opts: {
const store = kind === "session" ? window.sessionStorage : window.localStorage;
store.setItem(k, value);
},
{ kind: opts.kind, key, value: String(opts.value ?? "") },
{ kind: opts.kind, key, value: opts.value },
);
}