Generic props #11950
Unanswered
tcastelly
asked this question in
Help/Questions
Generic props
#11950
Replies: 1 comment
-
You should define generic components like this: import { defineComponent } from 'vue';
export default defineComponent(
<T extends string | number>(p: {
value?: T,
}) => () => <input value={p.value} />,
{
name: 'GInput',
props: {
value: [Number, String],
},
},
); |
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.
-
Hello,
I'm trying to write a component with generic props like this:
I've this error:
It seems that the
PropType
can't work with generic.Beta Was this translation helpful? Give feedback.
All reactions