What
Two type definition files have duplicate identifiers that will cause TypeScript compilation errors:
-
src/types/course.ts: EnrollmentStatus is defined twice — line 30 ("not_enrolled" | "active" | "completed" | "dropped") and line 98 ("not_enrolled" | "enrolled" | "in_progress" | "completed" | "expired"). The second silently shadows the first. Additionally, CourseEnrollment declares status twice (required on line 30, optional on line 47).
-
src/types/quiz.ts: QuizResult is defined as an interface on line 64 and then redefined as export type QuizResult = QuizAttempt on line 98. This is a duplicate identifier error.
Why
TypeScript will either refuse to compile or produce unpredictable type behavior. Any code depending on EnrollmentStatus union members or importing QuizResult will break. The duplicate status property in CourseEnrollment creates undefined required/optional semantics.
Scope
- Pick a single authoritative
EnrollmentStatus definition in src/types/course.ts
- Remove the duplicate
status property from CourseEnrollment
- Either remove the
QuizResult interface or the type alias in src/types/quiz.ts
- Update any consumers that depend on the removed/changed types
Acceptance criteria
Technical context
- Files:
src/types/course.ts:30,47,98, src/types/quiz.ts:64,98
- Consumer:
src/lib/api/courses.ts
- Consumer:
src/lib/api/quizzes.ts
- Consumer:
src/lib/hooks/use-courses.ts
What
Two type definition files have duplicate identifiers that will cause TypeScript compilation errors:
src/types/course.ts:EnrollmentStatusis defined twice — line 30 ("not_enrolled" | "active" | "completed" | "dropped") and line 98 ("not_enrolled" | "enrolled" | "in_progress" | "completed" | "expired"). The second silently shadows the first. Additionally,CourseEnrollmentdeclaresstatustwice (required on line 30, optional on line 47).src/types/quiz.ts:QuizResultis defined as an interface on line 64 and then redefined asexport type QuizResult = QuizAttempton line 98. This is a duplicate identifier error.Why
TypeScript will either refuse to compile or produce unpredictable type behavior. Any code depending on
EnrollmentStatusunion members or importingQuizResultwill break. The duplicatestatusproperty inCourseEnrollmentcreates undefined required/optional semantics.Scope
EnrollmentStatusdefinition insrc/types/course.tsstatusproperty fromCourseEnrollmentQuizResultinterface or the type alias insrc/types/quiz.tsAcceptance criteria
EnrollmentStatushas a single, correct definitionCourseEnrollment.statusappears once (with correct required/optional semantics)QuizResulthas a single definitionsubmitQuizreturn type matches actual API responseTechnical context
src/types/course.ts:30,47,98,src/types/quiz.ts:64,98src/lib/api/courses.tssrc/lib/api/quizzes.tssrc/lib/hooks/use-courses.ts