Overview
courseProgressStore.ts spreads a Partial<LessonProgress> into the store without checking if required fields (e.g., lessonId, progress) are present. This can leave the store in an inconsistent state.
Specifications
Features:
- Validate the
lessonData argument before merging using a type guard
- Reject updates that are missing required fields with a typed error
Tasks:
- Define
isValidLessonProgress(data: Partial<LessonProgress>): data is LessonProgress
- Apply it before the spread operation
- Write tests for missing required field scenarios
Impacted Files:
src/store/courseProgressStore.ts
Acceptance Criteria
- Invalid
lessonData never enters the store
- TypeScript catches missing required fields at compile time
- Tests verify rejection of incomplete updates
Overview
courseProgressStore.tsspreads aPartial<LessonProgress>into the store without checking if required fields (e.g.,lessonId,progress) are present. This can leave the store in an inconsistent state.Specifications
Features:
lessonDataargument before merging using a type guardTasks:
isValidLessonProgress(data: Partial<LessonProgress>): data is LessonProgressImpacted Files:
src/store/courseProgressStore.tsAcceptance Criteria
lessonDatanever enters the store