import { createVanilla } from '../vanilla/index.js' import { withUseSnapshot, withUseSubscribe } from './enhancers/index.js' import type { ExpandType } from '../utils/index.js' import type { SnapshotSelector } from '../vanilla/index.js' import type { WithUseSnapshotContributes, WithUseSubscribeContributes } from './enhancers/index.js' import type { StoreCreateOptions, VanillaStore } from '../vanilla/create.js' import type { WithSnapshotContributes, WithSubscribeContributes, } from '../vanilla/enhancers/index.js' import type { SnapshotOptions } from './use-snapshot.js' export interface StoreUseSnapshot { (): State (options: SnapshotOptions): State (selector: SnapshotSelector): StateSlice (selector: undefined, options: SnapshotOptions): State ( selector: SnapshotSelector, options: SnapshotOptions ): StateSlice } export interface Store extends ExpandType< VanillaStore & WithSubscribeContributes & WithSnapshotContributes & WithUseSnapshotContributes & WithUseSubscribeContributes > {} export function createWithHooks( initialState: State, options: StoreCreateOptions = {} ): Store { return withUseSnapshot(withUseSubscribe(createVanilla(initialState, options))) }