Usage outside Vue component
You can import the useTypedRouter
composable from where it's generated.
Exemple with pinia
store here
import pinia from 'pinia';
import { useRouter } from '@typed-router';
export const useFooStore = defineStore('foo', () => {
function bar() {
const router = useRouter();
router.push({ name: 'profile-user', params: { user: 2 } });
}
return {
bar
}
});