/opt/canhelp/node_modules/nanostores/map-creator
Edit: /opt/canhelp/node_modules/nanostores/map-creator/index.d.ts (745B)
import type { MapStore } from '../map/index.js'
export interface MapCreator<
Value extends object = any,
Args extends any[] = []
> {
(id: string, ...args: Args): MapStore
build(id: string, ...args: Args): MapStore
cache: {
[id: string]: MapStore<{ id: string } & Value>
}
}
/**
* Create function to create map stores. It will be like a class for store.
*
* @param init Store’s initializer. Returns store destructor.
*/
export function mapCreator<
Value extends object,
Args extends any[] = [],
StoreExt = Record
>(
init?: (
store: MapStore<{ id: string } & Value> & StoreExt,
id: string,
...args: Args
) => (() => void) | void
): MapCreator