import {reactive, toRaw, readonly, isReactive} from 'vue'; import {useReactive} from "./index"; export default function useReadonly(initialState: T | (() => T) = {} as T): [Readonly, (patch: Partial | ((prevState: T) => Partial)) => void] { const [state, setState] = useReactive(initialState); return [readonly(state) as Readonly, setState as (patch: Partial | ((prevState: T) => Partial)) => void]; }