How to fix props type inheritance? #13970
FragsterAt
started this conversation in
General Discussions
Replies: 2 comments
-
with vue-component-type-helpers and following code: import type { ComponentProps } from 'vue-component-type-helpers';
import { VBtn } from 'vuetify/components/VBtn';
type VBtnProps = ComponentProps<typeof VBtn>
const {color='primary', variant='text', ...props} = defineProps<VBtnProps>() everything also works in VS Code, but in browser I have different error:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I find workaround: add @vue-ignore magic comment (from https://github.com/vuejs/language-tools/wiki/Directive-Comments) and set defaults in template: <template>
<v-btn
class="px-2 -mx-2 !max-w-none"
color="primary"
variant="text"
v-bind="props">
<slot></slot>
</v-btn>
</template>
<script setup lang="ts">
import { VBtn } from 'vuetify/components/VBtn';
type VBtnProps = /* @vue-ignore */ InstanceType<typeof VBtn>['$props']
const props = defineProps<VBtnProps>()
</script> but I don't like it. Is there a better solution? |
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.
-
I'm trying to type component, that have all props from used component, here is my code:
in VS Code all works as expected, but when I run
npm run dev
I see this error in console and browser:Vue version: 3.5.22
How can I fix that?
Beta Was this translation helpful? Give feedback.
All reactions