Skip to content

Commit 367a3d6

Browse files
authored
fix: broken types on the PaginationLink + bump tanstack/router (#423)
* tanstack router * tanstack router plugin * fix: types on the pagination `<Link>`
1 parent 85d8577 commit 367a3d6

File tree

3 files changed

+26
-60
lines changed

3 files changed

+26
-60
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
"@tanstack/query-broadcast-client-experimental": "^5.56.2",
4949
"@tanstack/react-query": "^5.56.2",
5050
"@tanstack/react-query-devtools": "^5.56.2",
51-
"@tanstack/react-router": "^1.58.3",
51+
"@tanstack/react-router": "^1.58.9",
5252
"@tanstack/react-table": "^8.20.5",
5353
"@tanstack/react-virtual": "^3.10.7",
54-
"@tanstack/router-devtools": "^1.58.3",
54+
"@tanstack/router-devtools": "^1.58.9",
5555
"@ts-rest/core": "^3.51.0",
5656
"class-variance-authority": "^0.7.0",
5757
"clsx": "^2.1.1",
@@ -86,7 +86,7 @@
8686
"@tailwindcss/forms": "^0.5.9",
8787
"@tailwindcss/typography": "^0.5.15",
8888
"@tanstack/eslint-plugin-router": "^1.58.6",
89-
"@tanstack/router-plugin": "^1.58.4",
89+
"@tanstack/router-plugin": "^1.58.10",
9090
"@types/node": "^22.5.4",
9191
"@types/react": "^18.3.5",
9292
"@types/react-dom": "^18.3.0",

pnpm-lock.yaml

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ui/pagination.tsx

+6-40
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,12 @@ const PaginationItem = React.forwardRef<
4848
));
4949
PaginationItem.displayName = "PaginationItem";
5050

51-
type PaginationLinkProps<
52-
TRouter extends AnyRouter = RegisteredRouter,
53-
TFrom extends RoutePaths<TRouter["routeTree"]> | string = string,
54-
TTo extends string = "",
55-
TMaskFrom extends RoutePaths<TRouter["routeTree"]> | string = TFrom,
56-
TMaskTo extends string = "",
57-
> = Pick<ButtonProps, "size"> & { isActive?: boolean } & LinkProps<
58-
TRouter,
59-
TFrom,
60-
TTo,
61-
TMaskFrom,
62-
TMaskTo
63-
> &
51+
type PaginationLinkProps = Pick<ButtonProps, "size"> & {
52+
isActive?: boolean;
53+
} & LinkProps &
6454
LinkComponentProps<"a">;
6555

66-
const PaginationLink = <
67-
TRouter extends AnyRouter = RegisteredRouter,
68-
TFrom extends RoutePaths<TRouter["routeTree"]> | string = string,
69-
TTo extends string = "",
70-
TMaskFrom extends RoutePaths<TRouter["routeTree"]> | string = TFrom,
71-
TMaskTo extends string = "",
72-
>(
73-
props: PaginationLinkProps<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
74-
) => {
56+
const PaginationLink = (props: PaginationLinkProps) => {
7557
const { size, className, isActive = false, ...rest } = props;
7658

7759
return (
@@ -117,15 +99,7 @@ const PaginationButton = ({
11799
);
118100
PaginationButton.displayName = "PaginationButton";
119101

120-
const PaginationLinkPrevious = <
121-
TRouter extends AnyRouter = RegisteredRouter,
122-
TFrom extends RoutePaths<TRouter["routeTree"]> | string = string,
123-
TTo extends string = "",
124-
TMaskFrom extends RoutePaths<TRouter["routeTree"]> | string = TFrom,
125-
TMaskTo extends string = "",
126-
>(
127-
props: PaginationLinkProps<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
128-
) => {
102+
const PaginationLinkPrevious = (props: PaginationLinkProps) => {
129103
const { className, ...rest } = props;
130104
return (
131105
<PaginationLink
@@ -157,15 +131,7 @@ const PaginationButtonPrevious = ({
157131
);
158132
PaginationButtonPrevious.displayName = "PaginationButtonPrevious";
159133

160-
const PaginationLinkNext = <
161-
TRouter extends AnyRouter = RegisteredRouter,
162-
TFrom extends RoutePaths<TRouter["routeTree"]> | string = string,
163-
TTo extends string = "",
164-
TMaskFrom extends RoutePaths<TRouter["routeTree"]> | string = TFrom,
165-
TMaskTo extends string = "",
166-
>(
167-
props: PaginationLinkProps<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
168-
) => {
134+
const PaginationLinkNext = (props: PaginationLinkProps) => {
169135
const { className, ...rest } = props;
170136
return (
171137
<PaginationLink

0 commit comments

Comments
 (0)