diff --git a/modules/data/src/effects/entity-cache-effects.ts b/modules/data/src/effects/entity-cache-effects.ts index 577f5148ea..688483a1f0 100644 --- a/modules/data/src/effects/entity-cache-effects.ts +++ b/modules/data/src/effects/entity-cache-effects.ts @@ -129,7 +129,9 @@ export class EntityCacheEffects { // Emit which ever gets there first; the other observable is terminated. return race(c, d); } catch (err) { - return this.handleSaveEntitiesError$(action)(err); + return this.handleSaveEntitiesError$(action)( + err as DataServiceError | Error + ); } } diff --git a/modules/data/src/effects/entity-effects.ts b/modules/data/src/effects/entity-effects.ts index 0617203019..a1a4e687bb 100644 --- a/modules/data/src/effects/entity-effects.ts +++ b/modules/data/src/effects/entity-effects.ts @@ -102,8 +102,8 @@ export class EntityEffects { // Emit which ever gets there first; the other observable is terminated. return race(c, d); - } catch (err) { - return this.handleError$(action)(err); + } catch (err: unknown) { + return this.handleError$(action)(err as Error); } } @@ -170,7 +170,7 @@ export class EntityEffects { // ensure observable takes some time, // as app likely assumes asynchronous response. return (error: Error) => - of(this.resultHandler.handleError(action)(error)).pipe( + of(this.resultHandler.handleError(action)(error as Error)).pipe( delay(this.responseDelay, this.scheduler || asyncScheduler) ); } diff --git a/modules/data/src/reducers/entity-cache-reducer.ts b/modules/data/src/reducers/entity-cache-reducer.ts index 5f8c49d8b4..135909dfb1 100644 --- a/modules/data/src/reducers/entity-cache-reducer.ts +++ b/modules/data/src/reducers/entity-cache-reducer.ts @@ -213,13 +213,8 @@ export class EntityCacheReducerFactory { entityCache: EntityCache, action: SaveEntities ) { - const { - changeSet, - correlationId, - isOptimistic, - mergeStrategy, - tag, - } = action.payload; + const { changeSet, correlationId, isOptimistic, mergeStrategy, tag } = + action.payload; try { changeSet.changes.forEach((item) => { @@ -243,8 +238,8 @@ export class EntityCacheReducerFactory { throw act.payload.error; } }); - } catch (error) { - action.payload.error = error; + } catch (error: unknown) { + action.payload.error = error as Error; } return entityCache; @@ -293,13 +288,8 @@ export class EntityCacheReducerFactory { entityCache: EntityCache, action: SaveEntitiesSuccess ) { - const { - changeSet, - correlationId, - isOptimistic, - mergeStrategy, - tag, - } = action.payload; + const { changeSet, correlationId, isOptimistic, mergeStrategy, tag } = + action.payload; changeSet.changes.forEach((item) => { const entityName = item.entityName; @@ -344,18 +334,17 @@ export class EntityCacheReducerFactory { ) { const entityName = action.payload.entityName; const collection = cache[entityName]; - const reducer = this.entityCollectionReducerRegistry.getOrCreateReducer( - entityName - ); + const reducer = + this.entityCollectionReducerRegistry.getOrCreateReducer(entityName); let newCollection: EntityCollection; try { newCollection = collection ? reducer(collection, action) : reducer(this.entityCollectionCreator.create(entityName), action); - } catch (error) { + } catch (error: unknown) { this.logger.error(error); - action.payload.error = error; + action.payload.error = error as Error; } return action.payload.error || collection === newCollection!