Best practice for reusable types in defineProps #10944
Unanswered
AnnaYuS
asked this question in
Help/Questions
Replies: 1 comment
-
type TextFieldProps = ComponentProps<typeof TextField>;
interface Props extends /* @vue-ignore */ TextFieldProps {
label?: string;
meter?: boolean;
required?: boolean;
invalid?: boolean | string;
help?: string;
}
const valueModel = defineModel<string>('value', { default: '' });
defineProps<Props>(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My goal is to add prop types in
defineProps
that use prop types of another component:But this fails with
Error: [vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
In vue docs it says that this error is expected kind of:
i've tried to use
ComponentProps
fromvue-component-type-helpers
but this also throws an errorI was wondering if anyone has found a workaround for this or knows a better way to make sure that the components use the same props?
Beta Was this translation helpful? Give feedback.
All reactions