RxJs 6: Get ConnectableObservable from Observable
import { ConnectableObservable } from "rxjs"
import { publish } from "rxjs/operators";
const myConnectableObservable: ConnectableObservable<MyClass> = myService.getObservable().pipe(publish()) as ConnectableObservable<MyClass>;
Special thanks to @cartant