• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

345
Views
MergeMap in Ngrx Effect cause types error

i have NgRX effect class which i think is almost the same as in docs.

import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { EMPTY } from 'rxjs';
import { map, mergeMap, catchError } from 'rxjs/operators';
import { SocialLearningFacadeService } from '../../facades/social-learning-facade.service';
import { loadCategories, retreivedCategories } from '../actions/categories';

@Injectable()
export class CategoriesEffects {
  loadMovies$: any = createEffect((): any =>
    this.actions$.pipe(
      ofType(loadCategories),
      mergeMap(() =>
        this.socialLearningFacadeService.getSocialLearningCategories().pipe(
          map((categories) =>
            retreivedCategories({ socialLearningCategories: categories })
          ),
          catchError(() => EMPTY)
        )
      )
    )
  );

  constructor(
    private actions$: Actions,
    private socialLearningFacadeService: SocialLearningFacadeService
  ) {}
}

my actions:

import { createAction, props } from '@ngrx/store';
import type { SocialLearningCategory } from '../../../../core/models/socialLearningCategory';

export const loadCategories = createAction('load categories');

export const retreivedCategories = createAction(
  'retreived social learning categories',
 props<{ socialLearningCategories: any }>()
);

and there is this error on MergeMap:

enter image description here

I have no clue how to interprete this error, espacially that my example is very similar to the docs one and still doesn't work.

EDIT: Social learning facade service

import { Observable } from 'rxjs';
import { Injectable } from '@angular/core';
import { SocialLearningService } from '../services/social-learning.service';
import type { SocialLearningCategory } from '../../../core/models/socialLearningCategory';
import type { SocialLearningCategoryDetails } from '../../../core/models/socialLearningCategoryDetails';

@Injectable({
  providedIn: 'root',
})
export class SocialLearningFacadeService {
  constructor(private socialLearningService: SocialLearningService) {}

  public getSocialLearningCategories(): Observable<SocialLearningCategory[]> {
    return this.socialLearningService.getSocialLearningCategories();
  }

  public getSocialLearningCategoryDetails(
    id: number
  ): Observable<SocialLearningCategoryDetails> {
    return this.socialLearningService.getSocialLearningCategoryDetails(id);
  }
}
almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error