Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/solid/store/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type {
SetStoreFunction,
SolidStore,
Store,
StoreBundle,
StoreNode,
StorePathRange,
StoreSetter
Expand Down
4 changes: 3 additions & 1 deletion packages/solid/store/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ export interface SetStoreFunction<T> {
): void;
}

export type StoreBundle<T> = [get: Store<T>, set: SetStoreFunction<T>];

/**
* Creates a reactive store that can be read through a proxy object and written with a setter function
*
Expand All @@ -499,7 +501,7 @@ export function createStore<T extends object = {}>(
...[store, options]: {} extends T
? [store?: T | Store<T>, options?: { name?: string }]
: [store: T | Store<T>, options?: { name?: string }]
): [get: Store<T>, set: SetStoreFunction<T>] {
): StoreBundle<T> {
const unwrappedStore = unwrap((store || {}) as T);
const isArray = Array.isArray(unwrappedStore);
if ("_SOLID_DEV_" && typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function")
Expand Down