diff --git a/packages/location-state-core/src/hooks.ts b/packages/location-state-core/src/hooks.ts index 7aeddb82..8d2d53b4 100644 --- a/packages/location-state-core/src/hooks.ts +++ b/packages/location-state-core/src/hooks.ts @@ -29,7 +29,10 @@ const useStore = (storeName: DefaultStoreNames | string) => { return store; }; -export const useLocationState = ( +export const useLocationState = < + T, + StoreName extends string = DefaultStoreNames, +>( definition: LocationStateDefinition, ): [T, SetState] => { const storeState = useLocationStateValue(definition); @@ -37,7 +40,10 @@ export const useLocationState = ( return [storeState, setStoreState]; }; -export const useLocationStateValue = ( +export const useLocationStateValue = < + T, + StoreName extends string = DefaultStoreNames, +>( definition: LocationStateDefinition, ): T => { const { name, defaultValue, storeName, refine } = useState(definition)[0]; @@ -60,7 +66,10 @@ export const useLocationStateValue = ( return storeState; }; -export const useLocationSetState = ( +export const useLocationSetState = < + T, + StoreName extends string = DefaultStoreNames, +>( definition: LocationStateDefinition, ): SetState => { const { name, defaultValue, storeName, refine } = useState(definition)[0];