I'm using Nuxt 3 / Vue 3 defineProps
and TypeScript and want to infer types prop types from TypeScript types.
import { User } from '~/types/types' const props = defineProps({ users: { type: Array, // User[]? }, })
In this example, how do I make the users
property be of type User[]
?
P粉0709187772023-10-31 00:24:00
Using Vue’sPropType
import { PropType } from 'vue' import { User } from '~/types/types' const props = defineProps = ({ users: { type: Array as PropType<User[]> }, })