Skip to content

Commit

Permalink
fix(react): Fix query param hook types (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion committed Dec 24, 2022
1 parent b64101c commit 3dcab93
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/lib/react/hookMakers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ interface QueryParamHook {
route: Routeway<PathLike, CodecMap, Q>,
key: K,
): [
Partial<Q>[K],
Dispatch<SetStateAction<Partial<Q>[K]>>,
Partial<CodecsToRecord<Q>>[K],
Dispatch<SetStateAction<Partial<CodecsToRecord<Q>>[K]>>,
];
/**
* Make a state out of the query parameters of an specific route. The codecs
Expand All @@ -44,10 +44,10 @@ interface QueryParamHook {
<Q extends CodecMap, K extends keyof Q>(
route: Routeway<PathLike, CodecMap, Q>,
key: K,
fallback: NonNullable<Partial<Q>[K]>,
fallback: NonNullable<Partial<CodecsToRecord<Q>>[K]>,
): [
Q[K],
Dispatch<SetStateAction<NonNullable<Q[K]>>>,
CodecsToRecord<Q>[K],
Dispatch<SetStateAction<NonNullable<CodecsToRecord<Q>[K]>>>,
];
}

Expand Down Expand Up @@ -93,7 +93,7 @@ type NavigatorHook<T extends Record<string, Routeway>> =
}
: never;

type GotToHook = <S extends Routeway>(route: S, options?: NavigateOptions) =>
type GoToHook = <S extends Routeway>(route: S, options?: NavigateOptions) =>
(...params: Parameters<S["makeUrl"]>) => () => void;

/**
Expand All @@ -105,7 +105,7 @@ type GotToHook = <S extends Routeway>(route: S, options?: NavigateOptions) =>
*
* @deprecated in favour of {@link https://www.npmjs.com/package/react-routeways react-routeways} package
*/
export function makeGotToHook(getNavigate: () => NavigateFn): GotToHook {
export function makeGotToHook(getNavigate: () => NavigateFn): GoToHook {
return (route, options) => {
const navigate = getNavigate();

Expand Down

0 comments on commit 3dcab93

Please sign in to comment.