Usage without autoImport

If you have configured your Nuxt app like this:

export default defineNuxtConfig({
  imports: {
    autoImport: false
  }
})

It's still possible to use the typed useRouter and useRoute, but Typescripts limit the module override capability for #app.

But Nuxt Typed Router will create an alias @typed-router where you can import router composables

import {useRouter, useRoute, navigateTo} from '@typed-router';

const router = useRouter();

router.push({name: 'foo', params: { foo: 'bar' }});

navigateTo({name: 'foo', params: { foo: 'bar' }});

const route = useRoute('profile-id');