Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings error for $observables #127

Open
MohitTilwani15 opened this issue Jul 7, 2020 · 0 comments
Open

Typings error for $observables #127

MohitTilwani15 opened this issue Jul 7, 2020 · 0 comments

Comments

@MohitTilwani15
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant