Skip to content
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

types: Spreading $props causes typescript error #5968

Merged
merged 3 commits into from May 20, 2022

Conversation

pikax
Copy link
Member

@pikax pikax commented May 20, 2022

fix #5969

import { defineComponent } from 'vue'

declare function expectType<T>(t: T): void

const Child = defineComponent({
    props: {
        bar: String
    }
})

const Parent = defineComponent({
    props: {
        ...Child.props,
        foo: String
    }
})

const child = new Child()

expectType<JSX.Element>(<Parent {...child.$props} />) // error

@pikax pikax changed the title types(VNodeRef): export VNodeRef types: Spreading $props causes typescript error May 20, 2022
@yyx990803 yyx990803 merged commit 0c7fd13 into main May 20, 2022
@yyx990803 yyx990803 deleted the pikax/vnode_ref_ts_error branch May 20, 2022 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

types: Spread props causes typescript error
2 participants