The Netlify build was failing with TypeScript error TS2802 because the code was using the spread operator [...new Set()] to iterate over a Set, which requires the downlevelIteration flag.
- Location: Line 162 in
src/components/employees/EmployeeManagement.tsx - Problem:
const departments = [...new Set(employees.map(emp => emp.department))].filter(Boolean) - Root Cause: TypeScript couldn't compile Set iteration to ES5 target without downlevelIteration
Added "downlevelIteration": true to the tsconfig.json compiler options.
/tsconfig.json: AddeddownlevelIteration: trueto compilerOptions
- Commit and Push Changes: The TypeScript configuration has been updated
- Trigger New Build: Go to Netlify → Deploys → Deploy site
- Environment Variables: Make sure your Supabase credentials are still configured
- ✅ Enables proper Set iteration support in TypeScript compilation
- ✅ Allows spread operator on Sets for older JavaScript targets
- ✅ Resolves the TS2802 compilation error
- ✅ Maintains compatibility with React-scripts build process
Your Netlify build should now succeed! The TypeScript compiler will now properly handle Set iteration when targeting ES5.
This is a common issue with Create React App projects using modern JavaScript features (like Set iteration) with older compilation targets. The downlevelIteration flag allows TypeScript to properly transform modern iteration patterns for older JavaScript versions.