#!/bin/bash echo "Fixing React TypeScript issues..." # Create a temporary package.json backup cp package.json package.json.bak # Remove React and its types npm uninstall react react-dom @types/react @types/react-dom # Clean npm cache npm cache clean --force # Install React and its types with specific versions known to work well together npm install --save react@18.2.0 react-dom@18.2.0 npm install --save-dev @types/react@18.2.0 @types/react-dom@18.2.0 # Create a proper tsconfig.json if it doesn't exist cat > tsconfig.json << EOL { "compilerOptions": { "target": "ES2020", "useDefineForClassFields": true, "lib": ["ES2020", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, "moduleResolution": "node", "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "baseUrl": ".", "paths": { "@/*": ["src/*"] }, "types": ["vite/client", "node"] }, "include": ["src", "**/*.ts", "**/*.tsx", "src/types/*.d.ts"], "references": [{ "path": "./tsconfig.node.json" }] } EOL # Create a proper tsconfig.node.json if it doesn't exist cat > tsconfig.node.json << EOL { "compilerOptions": { "composite": true, "skipLibCheck": true, "module": "ESNext", "moduleResolution": "node", "allowSyntheticDefaultImports": true }, "include": ["vite.config.ts"] } EOL echo "React TypeScript issues fixed! Please restart your IDE or TypeScript server." echo "You can now run 'npm run dev' to start the development server."