0
votes

I am trying to implement map, PublishReplay, etc in Angular6 but every time it gives me compilation error saying "Property 'map' does not exist on type 'Observable<[{}, {}]>'". Similar happens when I apply the other rxjs things.

I have tried

importing map, installing rxjs-compat, editing tsconfig.json

  unifiedSearch: Function = (query: string): Observable<UnifiedSearch> => {
    return forkJoin(
      this.searchService.gitSearch(query),
      this.codeSearchService.codeSearch(query)
    ).map((response :[GitSearch,GitCodeSearch])=> {
      return {
        respositories: response[0],
        code: response[1]
      };
    });
  };

And if I am trying to implement it with the help of "pipes" then it says I can't find map.

 unifiedSearch: Function = (query: string): Observable<UnifiedSearch> => {
    return forkJoin(
      this.searchService.gitSearch(query),
      this.codeSearchService.codeSearch(query)
    ).pipe(map((response :[GitSearch,GitCodeSearch])=> {
      return {
        respositories: response[0],
        code: response[1]
      };
    }));
  };

Error while implementing maps

1

1 Answers

0
votes

make sure you import map like this -

import { map } from 'rxjs/operators';

and use pipe as well.