export function getErrnoCode(error: unknown): string | undefined { if (typeof error !== 'object' || error === null) { return undefined } const rec = error as Record return typeof rec.code === 'string' ? rec.code : undefined }