Based on @hopebordarh answer, you can also use .clone to avoid mutations on original values as following:
import moment from 'moment'
// 👉 Search period
const initialDate = moment()
const finalDate = moment().add(9, 'days')
const dateRange = [] as string[]
const dateRangeStart = initialDate.clone()
while (dateRangeStart.isBefore(finalDate)) {
dateRange.push(dateRangeStart.toDate())
dateRangeStart.add(1, 'days')
}