Skip to content

[TypeScript] courseProgressStore.ts spreads Partial<LessonProgress> without required field verification #808

Description

@RUKAYAT-CODER

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions