UNPKG

zustand-yjs

Version:

Zustand Stores with Yjs

8 lines (7 loc) 369 B
import * as Y from 'yjs'; declare type MapFunctions<T> = Pick<Y.Map<T>, 'set' | 'get' | 'has' | 'delete' | 'forEach' | 'entries' | 'values' | 'keys'>; declare type MapWrapper<T, U extends Record<string, T>> = { data: U; } & MapFunctions<T>; declare const useYMap: <T, U extends Record<string, T>>(yMap: Y.Map<T>) => MapWrapper<T, U>; export default useYMap;