We can declare the type of this variable and have TS help us avoid mistakes when working with it. Furthermore, we can move this duplicated declaration of collection into a separate file and just import it from all three locations. This way, we reduce the room for mistakes and make it easier to adjust the type of collection later (if needed).
Also: see if we need to do the same for other variables declared next to collection.
https://github.com/thermobased/flask-webapp/blob/81c298458ab0eab9add77629529f26d965e36183/frontend/render_remove_habit.ts#L1
https://github.com/thermobased/flask-webapp/blob/81c298458ab0eab9add77629529f26d965e36183/frontend/render_remove_datapoint.ts#L1
https://github.com/thermobased/flask-webapp/blob/81c298458ab0eab9add77629529f26d965e36183/frontend/render_calendar.ts#L3
We can declare the type of this variable and have TS help us avoid mistakes when working with it. Furthermore, we can move this duplicated declaration of
collection
into a separate file and just import it from all three locations. This way, we reduce the room for mistakes and make it easier to adjust the type ofcollection
later (if needed).Also: see if we need to do the same for other variables declared next to
collection
.Ivan