@stackoverfloweth/vue-compositions
Version:
A collection of reusable vue compositions.
15 lines (14 loc) • 460 B
TypeScript
import { Ref } from 'vue';
/**
* patch a specific property of an object ref
* @param source an object ref
* @param key the key to patch
* @returns
* @example
* const source = ref({ a: 1, b: 2 })
* const a = usePatchRef(source, 'a')
* a.value = 3
* console.log(source.value) // { a: 3, b: 2 }
* console.log(a.value) // 3
*/
export declare function usePatchRef<T extends Record<string, unknown>, P extends keyof T>(source: Ref<T>, key: P): Ref<T[P]>;