Skip to content

Commit

Permalink
cleanup of jsdocs of interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnlanre committed Nov 30, 2023
1 parent 7ae7576 commit 849e274
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/addons/index.ts
Original file line number Diff line number Diff line change
@@ -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";
8 changes: 2 additions & 6 deletions src/addons/useCookieImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ export function useCookieImplementation<
Path extends Paths<Store>,
State extends GetValueByPath<Store, Path>,
Data
>({
path,
initialState,
config,
portal,
}: UseCookieImplementation<Store, Path, State, Data>) {
>(properties: UseCookieImplementation<Store, Path, State, Data>) {
const { path, portal, config, initialState } = properties;
const {
key = path,
set = (value: State) => JSON.stringify(value),
Expand Down
8 changes: 2 additions & 6 deletions src/addons/useLocalImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ export function useLocalImplementation<
Path extends Paths<Store>,
State extends GetValueByPath<Store, Path>,
Data
>({
path,
portal,
config,
initialState,
}: UseLocalImplementation<Store, Path, State, Data>) {
>(properties: UseLocalImplementation<Store, Path, State, Data>) {
const { path, portal, config, initialState } = properties;
const {
key = path,
set = (value: State) => JSON.stringify(value),
Expand Down
13 changes: 4 additions & 9 deletions src/addons/usePortalImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,10 @@ export function usePortalImplementation<
Path extends Paths<Store>,
State extends GetValueByPath<Store, Path>,
Data
>({
path,
initialState,
options,
portal,
}: UsePortalImplementation<Store, Path, State, Data>): PortalState<
State,
Data
> {
>(
properties: UsePortalImplementation<Store, Path, State, Data>
): PortalState<State, Data> {
const { path, portal, options, initialState } = properties;
const {
set,
select = (value: State) => value as unknown as Data,
Expand Down
8 changes: 2 additions & 6 deletions src/addons/useSessionImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ export function useSessionImplementation<
Path extends Paths<Store>,
State extends GetValueByPath<Store, Path>,
Data
>({
path,
portal,
config,
initialState,
}: UseSessionImplementation<Store, Path, State, Data>) {
>(properties: UseSessionImplementation<Store, Path, State, Data>) {
const { path, portal, config, initialState } = properties;
const {
key = path,
set = (value: State) => JSON.stringify(value),
Expand Down
9 changes: 9 additions & 0 deletions src/definition/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => State;

/**
* Represents the method to set the value of the store.
* @template State The type of the state.
*/
export type SetStore<State> = (value: State) => void;

/**
Expand Down

0 comments on commit 849e274

Please sign in to comment.