This error occurs in Typescript using Angular 11.

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

Solution

Use this import:

import {Observable, fromEvent} from "rxjs";

And your code:

Observable.fromEvent(window, 'online');

to

fromEvent(window, 'online');