diff --git a/src/addons/index.ts b/src/addons/index.ts index 6b0b164..ea9ef28 100644 --- a/src/addons/index.ts +++ b/src/addons/index.ts @@ -1,7 +1,7 @@ +export * from "./makePortal"; export * from "./useShallowCompare"; export * from "./useDebouncedShallowEffect"; export * from "./usePortalImplementation"; export * from "./useCookieImplementation"; export * from "./useLocalImplementation"; export * from "./useSessionImplementation"; -export * from "./makePortal"; diff --git a/src/addons/useCookieImplementation.ts b/src/addons/useCookieImplementation.ts index fd9620c..81e497a 100644 --- a/src/addons/useCookieImplementation.ts +++ b/src/addons/useCookieImplementation.ts @@ -25,12 +25,8 @@ export function useCookieImplementation< Path extends Paths, State extends GetValueByPath, Data ->({ - path, - initialState, - config, - portal, -}: UseCookieImplementation) { +>(properties: UseCookieImplementation) { + const { path, portal, config, initialState } = properties; const { key = path, set = (value: State) => JSON.stringify(value), diff --git a/src/addons/useLocalImplementation.ts b/src/addons/useLocalImplementation.ts index df066d8..cbe6ad5 100644 --- a/src/addons/useLocalImplementation.ts +++ b/src/addons/useLocalImplementation.ts @@ -23,12 +23,8 @@ export function useLocalImplementation< Path extends Paths, State extends GetValueByPath, Data ->({ - path, - portal, - config, - initialState, -}: UseLocalImplementation) { +>(properties: UseLocalImplementation) { + const { path, portal, config, initialState } = properties; const { key = path, set = (value: State) => JSON.stringify(value), diff --git a/src/addons/usePortalImplementation.ts b/src/addons/usePortalImplementation.ts index fee2069..8c8cee5 100644 --- a/src/addons/usePortalImplementation.ts +++ b/src/addons/usePortalImplementation.ts @@ -51,15 +51,10 @@ export function usePortalImplementation< Path extends Paths, State extends GetValueByPath, Data ->({ - path, - initialState, - options, - portal, -}: UsePortalImplementation): PortalState< - State, - Data -> { +>( + properties: UsePortalImplementation +): PortalState { + const { path, portal, options, initialState } = properties; const { set, select = (value: State) => value as unknown as Data, diff --git a/src/addons/useSessionImplementation.ts b/src/addons/useSessionImplementation.ts index 786c373..76a0d29 100644 --- a/src/addons/useSessionImplementation.ts +++ b/src/addons/useSessionImplementation.ts @@ -23,12 +23,8 @@ export function useSessionImplementation< Path extends Paths, State extends GetValueByPath, Data ->({ - path, - portal, - config, - initialState, -}: UseSessionImplementation) { +>(properties: UseSessionImplementation) { + const { path, portal, config, initialState } = properties; const { key = path, set = (value: State) => JSON.stringify(value), diff --git a/src/definition/portal.ts b/src/definition/portal.ts index 65cc17a..0aa81d4 100644 --- a/src/definition/portal.ts +++ b/src/definition/portal.ts @@ -3,7 +3,16 @@ import type { SetStateAction, Dispatch } from "react"; import type { BehaviorSubject, Portal } from "@/subject"; import { CookieOptions } from "./cookie"; +/** + * Represents the method to get the portal's initial value. + * @template State The type of the state. + */ export type GetState = (state: State) => State; + +/** + * Represents the method to set the value of the store. + * @template State The type of the state. + */ export type SetStore = (value: State) => void; /**