Estoy creando un proyecto en Laravel 8 + Vue 3 con Typescript e Inertia
Tengo este error todo el tiempo
TS2571: Object is of type 'unknown'.
en este código
console.log(usePage().props.value.auth.user);
Ahí está mi autenticación y la interfaz de usuario:
export interface UserInterface { id: number name: string email: string } export interface AuthInterface { user?: UserInterface } Cuando hago console.log sin .user , todo está bien.
Existe mi función usePage :
import {usePage as inertiaUsePage} from "@inertiajs/inertia-vue3"; export const usePage = () => { return inertiaUsePage<PageProps>(); } export interface PageProps { auth: AuthInterface }Reproduje su error y descubrí que también necesita tener vue3 & @inertiajs/inertia para que los tipos sean correctos.