Skip to content

Commit 0234350

Browse files
committed
refactor(doctor): narrow the copy error without a type assertion
The assertion-safety ratchet flagged the errno cast; property narrowing removes the assertion instead of annotating it.
1 parent 46c7dd7 commit 0234350

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/commands/doctor-config-preflight.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ async function maybeMigrateLegacyConfig(): Promise<string[]> {
104104
// EEXIST means a config already lives at the target — nothing to migrate.
105105
// Any other failure (EACCES, ENOSPC) must surface: doctor would otherwise
106106
// proceed as a fresh install while the operator's legacy config exists.
107-
// SAFETY: fs.copyFile rejections are Node errno errors; code is optional-read only.
108-
if ((err as NodeJS.ErrnoException).code !== "EEXIST") {
107+
const code = err && typeof err === "object" && "code" in err ? err.code : undefined;
108+
if (code !== "EEXIST") {
109109
throw new Error(
110110
`Failed to migrate legacy config ${legacyPath} -> ${targetPath}: ${formatErrorMessage(err)}`,
111111
{ cause: err },

0 commit comments

Comments
 (0)