Subscribe on changes!

Feature request. Types. Props type in DefineComponent type.

avatar
Jun 25th 2021

What problem does this feature solve?

Makes it possible to proxy props from one component to another.

What does the proposed API look like?

<ChildComponent v-bind="childProps" >
...
props: {
  ...ChildComponent.props
},
setup(props) {
    const childProps = componentPropsValues(ChildComponent, props)
    
    return { childProps }
}
avatar
Jun 25th 2021

This already works. Please use the chat or discord if you have questions!

avatar
Jun 28th 2021

@posva, This already works, true, but there is an issue with types. For some reason, there are not props types in the ComponentOptionsBase type.

I created code sandbox: https://codesandbox.io/s/eloquent-golick-996nz?file=/src/App.vue

image

If I add any props from the child component, then parent component props will have such type { [key: string]: any }

I made a function that extracts prop types, but it is not working with props without a default value.

I got this issue in the code sandbox and the local environment too.