Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit 61f1042

Browse files
committed
chore: improve types
1 parent c144a8e commit 61f1042

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/script.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let profiles: ProfilesList = [];
5858
let source: HTMLImageElement;
5959
let size: number;
6060
let profNum: number;
61-
let prof: string;
61+
let prof: number;
6262
let numNext: number;
6363
let start: Room;
6464
let end: Room;
@@ -115,7 +115,7 @@ async function clearAll() {
115115
window.clearAll = clearAll;
116116

117117
function createProfile(profNum: number) {
118-
prof = String(profNum);
118+
prof = profNum;
119119
const tempElementId = `tempProf${prof}`;
120120
const tempElementIdNext = `tempProf${profNum + 1}`;
121121
// Creates html elements in the courses class.
@@ -158,8 +158,8 @@ function createProfile(profNum: number) {
158158
<div class="container" id="${tempElementIdNext}"></div>`;
159159
}
160160

161-
function createCourse(num: string, profNum: string) {
162-
numNext = parseInt(num) + 1;
161+
function createCourse(num: number, profNum: number) {
162+
numNext = num + 1;
163163
const tempElementId = `temp${prof}${num}`;
164164
const tempElementIdNext = `temp${prof}${numNext}`;
165165
// Creates html elements in the courses class.
@@ -191,7 +191,7 @@ function createCourse(num: string, profNum: string) {
191191
<span class="containerinpt" id="passing${num}${prof}">
192192
<button
193193
class="purple btninpt showpth"
194-
onclick="passingTime(${parseInt(num) - 1}, ${profNum})"
194+
onclick="passingTime(${num - 1}, ${profNum})"
195195
>
196196
Show Path
197197
<span class="big-text"><i class="fa-solid fa-down-long"></i></span>
@@ -213,7 +213,7 @@ async function applySavedProfiles() {
213213
(document.getElementById(`nameProf${i}`) as HTMLInputElement).value =
214214
profiles[0]![i]! as string;
215215
for (let f = 1; f < profiles[i]!.length + 1; f++) {
216-
createCourse(String(f), String(i));
216+
createCourse(f, i);
217217
(
218218
document.getElementById(`rmnum${f}${i}txt`) as HTMLInputElement
219219
).value = profiles[i]![f - 1]![0]!;
@@ -342,22 +342,22 @@ function createCanvas() {
342342
}
343343

344344
function courseLoop(profNum: number) {
345-
prof = String(profNum);
345+
prof = profNum;
346346
coursesAmt =
347347
parseInt(
348348
(document.getElementById(`num${profNum}`) as HTMLInputElement).value,
349349
) + 1;
350350
if (!Number.isNaN(coursesAmt)) {
351351
for (let i = 1; i < coursesAmt; i++) {
352-
createCourse(`${i}`, prof);
352+
createCourse(i, prof);
353353
}
354354
document.getElementById(`passing${coursesAmt - 1}${prof}`)!.innerHTML = "";
355355
}
356356
}
357357
window.courseLoop = courseLoop;
358358

359359
async function locateCourses(profNum: number) {
360-
prof = String(profNum);
360+
prof = profNum;
361361
profiles[profNum] = [];
362362
if (profiles[0] === undefined) {
363363
profiles[0] = [null, ""];

0 commit comments

Comments
 (0)