From 6334fe5696d0067f19ff68e1987b95f8b47cdb94 Mon Sep 17 00:00:00 2001 From: Riku Rauhala Date: Tue, 22 Oct 2024 19:39:28 +0300 Subject: [PATCH] [TypeScript] Replace some type assertions with type annotations --- services/backend/src/services/statMerger.ts | 4 ++-- .../ResultTabs/panes/charts/PassRateChart.tsx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/services/backend/src/services/statMerger.ts b/services/backend/src/services/statMerger.ts index 9b482e5bc3..cc5582a23f 100644 --- a/services/backend/src/services/statMerger.ts +++ b/services/backend/src/services/statMerger.ts @@ -1,6 +1,6 @@ export const populationCourseStatsMerger = (multiYearStats: any) => { - const courseCodes = [] as string[] - const stats = {} as Record + const courseCodes: string[] = [] + const stats: Record = {} stats.coursestatistics = [] stats.allStudents = 0 diff --git a/services/frontend/src/components/CourseStatistics/ResultTabs/panes/charts/PassRateChart.tsx b/services/frontend/src/components/CourseStatistics/ResultTabs/panes/charts/PassRateChart.tsx index dc791b03b3..06dd2d48b2 100644 --- a/services/frontend/src/components/CourseStatistics/ResultTabs/panes/charts/PassRateChart.tsx +++ b/services/frontend/src/components/CourseStatistics/ResultTabs/panes/charts/PassRateChart.tsx @@ -88,10 +88,10 @@ const passRateStudentGraphOptions = (isRelative: boolean, categories: string[], }) const getPassRateAttemptSeriesFromStats = stats => { - const all = [] as number[] - const passed = [] as number[] - const failed = [] as number[] - const enrolledNoGrade = [] as number[] + const all: number[] = [] + const passed: number[] = [] + const failed: number[] = [] + const enrolledNoGrade: number[] = [] stats.forEach(year => { const { passed: p, failed: f } = year.attempts.categories @@ -119,10 +119,10 @@ const getPassRateAttemptSeriesFromStats = stats => { } const getPassRateStudentSeriesFromStats = stats => { - const all = [] as number[] - const passed = [] as number[] - const failed = [] as number[] - const enrolledNoGrade = [] as number[] + const all: number[] = [] + const passed: number[] = [] + const failed: number[] = [] + const enrolledNoGrade: number[] = [] stats.forEach(year => { all.push(year.students.total || 0)