#5588·vueuse

BUG | `useRouteParams` | useRouteParams infers transform parameter type from defaultValue

Author: Arjan-akkermansCreated Aug 14, 2026Updated Sep 16, 2026
Labelshas pr

Describe the bug

because of the signature

`declare function useRouteParams< T extends RouteParamValueRaw = RouteParamValueRaw, K = T

( name: string, defaultValue?: MaybeRefOrGetter, options?: ReactiveRouteOptionsWithTransform<T, K> ): Ref;`

The inferred type of the transform value is equal to the default value: const employeeFilter = useRouteParams('employeeId', null, { transform: (value) => (!value ? null : Number(value)), });

e.g. with the above method the type for value is inferred as null (see reproduction)

Expected behaviour: Typing should be updated to be correct. I am not sure what is the best approach, are raw route params not always string/undefined? so maybe that would work? Otherwise, inferring the type to any/unknown I would also consider to be an improvement.

Reproduction

https://playground.vueuse.org/#eNp9kc1OAjEUhV/lphsgmTAxukIw/gQTXChBl900M5ex2Gmb/iCEzLt72wlIjGHXe85p+532wB6sHW8jsgmb+spJG8BjiBaU0M2Ms+A5u+Natta4AAeIHlcmBlwKJ1oPHaydaWFwT0eQVbrkucEt15XRPgC2Vpk94rNUpMPsz/7h4BhY1IMCdFSqgAPXAGUJW6EigqSTnMMqqD2EvcUahM/BlApOaL82rp3AMMdHMLuD4dWo4LobEQXX07KvRSVoCOk+EZCmaXk2sIKaEvJaNuONN5qeI2NwVpnWSoXuzQZJlTib9IDJE0qZ75esBReRLu316hOrr3/0jd8ljbOlQ49ui5ydvCBcg6G35++vuKP1yWxNHRWlL5gr9EbFxNjHHqOuCfssl2kX+SOlbj78fBdQ+2OpBJqSXc5zRh/6dKH6L+71+Cbvoxdn3Q/x+8fG

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 10.81 GB / 31.73 GB
  Binaries:
    Node: 24.18.0 - C:\nvm4w\nodejs\node.EXE
    npm: 11.16.0 - C:\nvm4w\nodejs\npm.CMD
    pnpm: 11.17.0 - C:\nvm4w\nodejs\pnpm.CMD
  Browsers:
    Chrome: 151.0.7922.138
    Edge: Chromium (151.0.4129.78)
  npmPackages:
    @vueuse/core: 14.3.0 => 14.3.0 
    @vueuse/router: 14.3.0 => 14.3.0 
    vue: 3.5.40 => 3.5.40

Used Package Manager

pnpm

Validations