Typeerror with v-bind="$props"
See original GitHub issueA.vue
<script lang="ts">
import {defineComponent, PropType} from "vue";
export default defineComponent({
name: "A",
props: {
x: {
type: Boolean as PropType<boolean>,
default: false
}
}
});
</script>
<template>{props}</template>
B.vue
<script lang="ts">
import {defineComponent, PropType} from "vue";
import A from "./A.vue";
export default defineComponent({
name: "B",
components: {A},
props: {
x: {
type: Boolean as PropType<boolean>,
default: false
}
}
});
</script>
<template>
<A
v-bind="$props"
/>
</template>
Error starting from 0.27.27
src/repro/B.vue:20:3 - error TS2322: Type '{ x?: boolean | undefined; ref?: VNodeRef | undefined; key?: string | number | symbol | undefined; onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[] | undefined; ... 6 more ...; style?: unknown; }' is not assignable to type 'IntrinsicAttributes & Partial<{ x: boolean; }> & Omit<Readonly<{ x?: unknown; } & { x: boolean; } & {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps, "x">'.
Type '{ x?: boolean | undefined; ref?: VNodeRef | undefined; key?: string | number | symbol | undefined; onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[] | undefined; ... 6 more ...; style?: unknown; }' is not assignable to type 'IntrinsicAttributes'.
Types of property 'ref' are incompatible.
Type 'VNodeRef | undefined' is not assignable to type 'string | Ref<any> | ((ref: Element | ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null) => void) | undefined'.
20 <A
~
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
[Bug Report][3.0.0-alpha.11] Dialog throws errors ... - GitHub
0-alpha.11] Dialog throws errors when clicking on it - Uncaught TypeError: Cannot read property 'contains' of undefined #14101.
Read more >javascript - Trigger components methods when click elsewhere
I've a HeaderSubmenu component which can show/hide a drop-down menu if a button is clicked. Okay, but now I try to find a...
Read more >[Solved]-Attempt to fetch Objects returns Uncaught TypeError
Coding example for the question Attempt to fetch Objects returns Uncaught TypeError: Object function ParsePromise()-Vue.js.
Read more >Error using structure field in k-form - Questions - Kirby forum
Writing on my first panel field extension I reached a point where I want to use a structure field inside the k-form component....
Read more >Vue 3, vue-router and typescript - Vue Forum
I am using Vue 3, router and typescript. Webpack is reporting a type error on the router-view component. TS7031: Binding element 'Component' ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pikax please cc, it seem that
VNodeProps.ref
type incompatible toReservedProps.ref
.@MoonCoral you can use
v-bind="{ ...$props, ref: undefined }"
instead ofv-bind="$props"
for now.It seems like it works if you pass
props
throughsetup
(e.g.setup(props) { return {props} }
) and dov-bind="props"
. Is it intentional thatprops
and$props
have different types? Are they different at runtime?