Skip to content

Fix build issue: Correct type error in lib/system-prompt.ts regarding 'map' usage #11

Description

@Emlembow

Description

The build is currently failing due to a type error in lib/system-prompt.ts at line 328. The error message indicates that the property map does not exist on type AboutContent | ProfileInfo | Education | Experience[] | Reference[] | BlogPost[] | Project[] and specifically points out that it does not exist on type AboutContent.

./lib/system-prompt.ts:328:54
Type error: Property 'map' does not exist on type 'AboutContent | ProfileInfo | Education | Experience[] | Reference[] | BlogPost[] | Project[]'.
  Property 'map' does not exist on type 'AboutContent'.

 326 |
 327 |     // Format work experience
> 328 |     const workExperience = experiences ? experiences.map((exp, index) => `
 329 | ### ${index + 1}. ${exp.title} at ${exp.company}
 330 | - **Duration**: ${exp.startDate} to ${exp.endDate}
 331 | - **Location**: ${exp.location}

Expected Behavior

The build should compile successfully without any type errors. The map function should be used only when experiences is an array.

Proposed Fix

  • Investigate the type definition of experiences to understand why it might be of type AboutContent (or other non-array types).
  • Implement proper type checking or type guards to ensure that .map is only invoked when experiences is actually an array.
  • Alternatively, update the type definitions so that experiences is typed correctly as an array where applicable.

Steps to Reproduce

  1. Clone the repository Emlembow/ChatWithPortfolio from branch master at commit 11007f8.
  2. Run npm install to install dependencies.
  3. Execute the build command: npm run build.

Additional Context

This issue surfaces during the Next.js build process when formatting work experience in the system prompt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions