Skip to content

Commit cea7a0a

Browse files
committed
Fix route params type
1 parent fcb7514 commit cea7a0a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

resources/js/ssr.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import createServer from '@inertiajs/vue3/server';
33
import { renderToString } from '@vue/server-renderer';
44
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
55
import { createSSRApp, DefineComponent, h } from 'vue';
6-
import { route, Router } from 'ziggy-js';
6+
import { route, RouteParams, Router } from 'ziggy-js';
77

88
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
99

@@ -24,8 +24,8 @@ createServer((page) =>
2424

2525
// bind config to ziggyRoute function
2626
function appRoute(): Router;
27-
function appRoute(name: string, params?: any, absolute?: boolean): string;
28-
function appRoute(name?: string, params?: any, absolute?: boolean): Router | string {
27+
function appRoute(name: string, params?: RouteParams<typeof name>, absolute?: boolean): string;
28+
function appRoute(name?: string, params?: RouteParams<string>, absolute?: boolean): Router | string {
2929
if (name === undefined) {
3030
return route();
3131
}

resources/js/types/ziggy.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Router as ZiggyRouter } from 'ziggy-js';
1+
import { Router as ZiggyRouter, RouteParams } from 'ziggy-js';
22

33
type AppRouter = {
44
(): ZiggyRouter;
5-
(name: string, params?: any, absolute?: boolean): string;
5+
(name: string, params?: RouteParams<typeof name> | undefined, absolute?: boolean): string;
66
};
77

88
declare global {

0 commit comments

Comments
 (0)