vuejs/vue-rx

Typings error for $observables

MohitTilwani15 opened this issue · 0 comments

@Component<HttpSearch>({
  domStreams: ["clear$"],
  subscriptions() {
    const searchTerm$ = new BehaviorSubject("");
    const news$ = searchTerm$.pipe(
      filter(val => val.length > 0),
      debounceTime(200),
      distinctUntilChanged(),
      switchMap(value =>
        from(axios.get(`${hackerNewsEndpoint}${value}`)).pipe(
          takeUntil(searchTerm$.pipe(skip(1)))
        )
      )
    );

    return {
      searchTerm$,
      news$
    };
  }
})
export default class HttpSearch extends Vue {
  searchTerm$!: any;
  news$!: any;

  private onkeyUp(event: Event) {
    this.$observables.searchTerm$.next(event.target!.value);
  }

  private clear() {
    this.$observables.searchTerm$.next("");
  }
}

The typings for $observables are not correct. At the moment, $observables can only be of type Observables which is not true because as per the above example searchTerm$ is a BehaviorSubject