Subscribe on changes!

TSX class components: unable to use custom props on subcomponents

avatar
Dec 6th 2021

Problem:

The TS compiler is complaining about invalid subcomponent props even though they exist: "Type X is not assignable to type 'IntrinsicAttributes & Partial<{}> & Omit<VNodeProps & AllowedComponentProps & ComponentCustomProps, never>".

Screen Shot 2021-12-05 at 11 01 12 PM

Troubleshooting:

Editing the linked line to (below) resolves the issue, but this is quite annoying to apply to each project + it isn't sustainable in the long run.

https://github.com/vuejs/vue-next/blob/6d887aaf591cfa05d5fea978bbd87e3e502bfa86/packages/runtime-dom/types/jsx.d.ts#L1339

interface IntrinsicAttributes extends ReservedProps {
  [key: string]: any;
}
Screen Shot 2021-12-05 at 11 01 47 PM

Deps (versions):

"vue": "^3.0.0", "vue-class-component": "^8.0.0-0", "@vue/babel-plugin-jsx": "^1.1.1", "@vue/cli-plugin-typescript": "~4.5.0",

Am I missing something here?

avatar
Dec 6th 2021

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!