@@ -204,18 +204,28 @@ function isRecord(value: unknown): value is Record<string, unknown> {
204204 return typeof value === ' object' && value !== null
205205}
206206
207- function toStringRecord (value : unknown ): Record <string , string > {
207+ function normalizeRouteRecord (value : unknown , source : ' params ' | ' query ' ): Record <string , string > {
208208 if (! isRecord (value )) {
209209 return {}
210210 }
211211
212212 const result: Record <string , string > = {}
213+ const droppedKeys: string [] = []
213214 for (const [key, entry] of Object .entries (value )) {
214215 if (typeof entry === ' string' ) {
215216 result [key ] = entry
217+ } else {
218+ droppedKeys .push (key )
216219 }
217220 }
218221
222+ if (droppedKeys .length > 0 ) {
223+ logger .warn (' Validation route normalization dropped non-string entries' , {
224+ source ,
225+ droppedKeys ,
226+ })
227+ }
228+
219229 return result
220230}
221231
@@ -429,8 +439,8 @@ const route = computed<RouteState>(() => {
429439 const rawRoute = (instance ?.proxy ?.$route as Partial <RouteState > | undefined ) ?? {}
430440 return {
431441 name: typeof rawRoute .name === ' string' ? rawRoute .name : null ,
432- params: toStringRecord (rawRoute .params ),
433- query: toStringRecord (rawRoute .query ),
442+ params: normalizeRouteRecord (rawRoute .params , ' params ' ),
443+ query: normalizeRouteRecord (rawRoute .query , ' query ' ),
434444 }
435445})
436446const router = computed <RouterState >(() => (instance ?.proxy ?.$router as RouterState | undefined ) ?? { push : () => {}, replace : () => {} })
0 commit comments