Я использую адаптер NGRX Entity для инициализации состояния (проблема возникает только с getInitialState
).
export const initialState = adapter.getInitialState({
eventsError: null,
eventsLoading: false
});
export function reducer(
state = initialState,
action: EventsActions
): State {
switch (action.type) {
case EventsActionTypes.getAllEvents: {
return Object.assign({}, ...state, { // error line
eventsLoading: true
});
}
// ...
Когда я хочу использовать оператор распространения для объекта состояния, я получаю ошибку:
ERROR in src/app/events/reducers/events.reducer.ts(36,35): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
Вот мой файл tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true,
"removeComments": true,
"sourceMap": true,
"target": "es6",
"module": "commonjs",
"experimentalDecorators": true,
"noEmitHelpers": false,
"emitDecoratorMetadata": true,
"declaration": false,
"lib": [
"es2015",
"dom"
],
"moduleResolution": "node",
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true
},
"compileOnSave": false,
"buildOnSave": false
}