Consider the structure of an array :
[
branch_a: {
holidays: []
},
branch_b: {
holidays: []
},
]
In this structure, branch_a
, branch_b
, and ...
represent dynamic keys. How can this be properly declared in typescript? Here is an attempt:
type holiday_ar = Array<string>
type holiday = Record<"holidays", holiday_ar> & Record<string, holiday_ar>
Following this, it becomes a bit confusing on how to proceed further.
It's important to note that I am currently learning typescript.