Encountered an error while setting up the reuder
:
/Users/Lxinyang/Desktop/angular/breakdown/ui/app/src/reducers/filters.spec.ts
(12,9): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ selectionState: { source: string; timeRange: Date[]; }; } | undefined'.
Type '{}' is not assignable to type '{ selectionState: { source: string; timeRange: Date[]; }; }'.
Property 'selectionState' is missing in type '{}'.
Here's the code snippet for the reducer:
const DATE_IN_MILLISECONDS = 60 * 60 * 24 * 1000
const todayDate = new Date()
const startDate = new Date(todayDate.getTime() - 6 * DATE_IN_MILLISECONDS)
const defaultFiltersState = {
selectionState: { source: 'all', timeRange: [startDate, todayDate] }
}
export function filters(state = defaultFiltersState, action: any) {}
Puzzled by this issue as I never assign {}
to the default state.
The combined root code looks like this:
export default combineReducers({ dataSource, filters, filtersVideo })