const fs = require('fs'); function fix(filename) { let code = fs.readFileSync(filename, 'utf8'); // Fix duplicate portalNode code = code.replace(/portalNode , portalNode/g, 'portalNode'); // Add type definition: replace `canEdit?: boolean;` with `canEdit?: boolean; portalNode?: HTMLDivElement | null;` code = code.replace(/canEdit\?: boolean;/g, 'canEdit?: boolean;\n portalNode?: HTMLDivElement | null;'); // For SeccionPendientes which has `canEdit: boolean })` code = code.replace(/canEdit: boolean \}\)/g, 'canEdit: boolean; portalNode?: HTMLDivElement | null; })'); // For SeccionIndicaciones (if it uses `canEdit?: boolean`) fs.writeFileSync(filename, code); } fix('src/sections/HistoriaClinica.tsx'); try { fix('src/sections/SeccionIndicaciones.tsx'); } catch(e){}