Answers for "TS2339: Property 'fromEvent' does not exist on type 'typeof Observable'."

0

TS2339: Property 'fromEvent' does not exist on type 'typeof Observable'.

import { fromEvent } from 'rxjs';
import { map, filter, debounceTime, tap, switchAll } from 'rxjs/operators';

  const obs = fromEvent(this.el.nativeElement, 'keyup')
    .pipe (
        map((e:any) => e.target.value), // extract the value of the input

        // filter((text:string) => text.length > 1), //filter out if empty

        debounceTime(250), //only search after 250 ms

        tap(() => this.loading.emit(true)), // Enable loading
        // search, call the search service

        map((query:string) => this.youtube.search(query)) ,
        // discard old events if new input comes in

        switchAll()
        // act on the return of the search
        )
Posted by: Guest on April-25-2022

Code answers related to "TS2339: Property 'fromEvent' does not exist on type 'typeof Observable'."

Browse Popular Code Answers by Language