Build Failure: TypeScript Error in ./lib/system-prompt.ts
Error Details
- File:
./lib/system-prompt.ts
- Line: 328
- Error: Type error: 'experiences' is possibly 'null'.
const workExperience = experiences.map((exp, index) => ... )
Build Log Excerpt
[11:39:35.514] ./lib/system-prompt.ts:328:28
Type error: 'experiences' is possibly 'null'.
328 | const workExperience = experiences.map((exp, index) => ... )
Suggested Fix
Add a null check for experiences before calling .map, e.g.:
const workExperience = experiences ? experiences.map((exp, index) => ...) : [];
Notes
- This error causes the Vercel build to fail.
- Please ensure
experiences is always an array (not null) before mapping.
- If
experiences can be null, provide a fallback (empty array or handle appropriately).
Steps to Reproduce:
- Trigger a build (e.g., via Vercel or
npm run build).
- Observe failure caused by the above type error.
Build Environment:
- Next.js: 15.2.4
- Node: (see builder's default)
- Vercel CLI: 42.2.0
If more info is needed, check the last build logs or ask for full logs from the Vercel dashboard.
Build Failure: TypeScript Error in
./lib/system-prompt.tsError Details
./lib/system-prompt.tsBuild Log Excerpt
Suggested Fix
Add a null check for
experiencesbefore calling.map, e.g.:Notes
experiencesis always an array (not null) before mapping.experiencescan be null, provide a fallback (empty array or handle appropriately).Steps to Reproduce:
npm run build).Build Environment:
If more info is needed, check the last build logs or ask for full logs from the Vercel dashboard.