Merge

advanced7 of 8

Learn about merge in fp-ts record

Code Editor

07-merge.exercise.ts

💻
Loading editor...
Preparing Monaco Editor with TypeScript support

Test Results

Requirements

describe('Record merge operations', () => {
  it('merges configs with overrides', () => {
    const defaults = { theme: 'light', fontSize: 14, debug: false }
    const overrides = { theme: 'dark', debug: true }
    const result = mergeConfigs(defaults, overrides)
    expect(result).toEqual({ theme: 'dark', fontSize: 14, debug: true })
  })

  it('combines scores by summing', () => {
    const scores1 = { alice: 10, bob: 20 }
    const scores2 = { bob: 15, charlie: 25 }
    const result = combineScores(scores1, scores2)
    expect(result).toEqual({ alice: 10, bob: 35, charlie: 25 })
  })
})
🧪

Ready to Test?

Click "Run Tests" to see how your code performs

Pro Tips

💡 Stuck? Here's what to try:

  • • Read the comments in the code carefully
  • • Run tests frequently to get feedback
  • • Check the fp-ts documentation
  • • Use the solution if you need help

🚀 Learning Approach:

  • • Focus on understanding, not just solving
  • • Experiment with different approaches
  • • Think about real-world applications
  • • Build on previous exercises