import { ObservableInput , from , Subscription , Observable } from 'rxjs' ; import { Ref , ref } from 'vue' ; import { untilUnmounted } from '../operators/until' ; type Subscribers < R , E > = { next : R ; error : E ; } ; type Refs < R , E > = { [ key in keyof Subscribers < R , E > ] : Ref < Subscribers < R , E > [ key ] > ; } & { subscription : Subscription ; value$ : Observable < R > ; } ; param input export function refsFrom < R , E = unknown > ( input ) ; param input param defaultValues export function refsFrom < R , E = unknown > ( input , defaultValues ) ; param input param defaultValues export function refsFrom < R , E > ( input , defaultValues ) ; export function refsFrom ( input , defaultValues = { } ) { const next = ref ( defaultValues . next ) ; const error = ref ( defaultValues . error ) ; const value$ = untilUnmounted ( from ( input ) ) ; return { next , error , value$ , subscription : value$ . subscribe ( { next : v => next . value = v , error : v => error . value = v , } ) } ; }