UNPKG

zustand-yjs

Version:

Zustand Stores with Yjs

8 lines (7 loc) 330 B
import * as Y from 'yjs'; declare type ArrayFunctions<T> = Pick<Y.Array<T>, 'forEach' | 'map' | 'slice' | 'get' | 'delete' | 'unshift' | 'push' | 'insert'>; declare type ArrayWrapper<T> = { data: T[]; } & ArrayFunctions<T>; declare const useYArray: <T>(yArray: Y.Array<T>) => ArrayWrapper<T>; export default useYArray;