-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
feat(types): support inferring attrs #7444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: minor
Are you sure you want to change the base?
Conversation
❌ Deploy Preview for vuejs-coverage failed.
|
b184ee3
to
12bf718
Compare
❌ Deploy Preview for vue-sfc-playground failed.
|
8635658
to
53ba854
Compare
@yyx990803 we need this in oku-ui, for example we need to go back the element types so that volar can suggest user auto-suggestion with both props and attrs types.
can you review and include this? |
Looks great. Could you please rebase your branch to resolve conflicts? I guess this feature will more be like |
53ba854
to
8a91c88
Compare
Size ReportBundles
Usages
|
df90c7c
to
f220643
Compare
This reverts commit 20e2364.
74395ad
to
6f9619b
Compare
@sxzz done |
This is much needed, thanks! |
@edison1105 Is this accidental? |
It will be reopen soon. |
@rudyxu1102 The scenario you mentioned seems to pertain to within the component, and it appears that there are also issues with how the parent component is using it. As follows: Assume that the ComText component is provided by another library, let's say: <template>
<div>{{ name }} - {{ age }}</div>
</template>
<script setup lang="ts">
defineOptions({
name: 'ComText',
})
const props = defineProps({
name: {
type: String,
default: '',
},
age: {
type: Number,
default: 0,
}
})
</script>
Wrap our component based on ComText. <template>
<ComText :name="name" v-bind="$attrs" />
</template>
<script setup lang="ts">
import ComText from './ComText.vue';
const props = defineProps<{
name: string;
}>();
</script> Actual usage import { defineComponent } from 'vue'
import { ComWrap } from './ComWrap'
const BusinessCard = defineComponent({
name: 'BusinessCard',
setup(props) {
return () => {
return <ComWrap name={props.name} age={10} />
}
}
}) The age property here will have a type error. Is there a way to resolve this type issue now? |
Related
RFC
Specific scenes
1. Wrapping an html element
2. Wrapping a Vue component