vue
vue copied to clipboard
When using spread syntax in tsx file, will cause a type error: TS2559
Version
2.7.8
Reproduction link
Steps to reproduce
- create two file A.tsx,B.tsx
- A.tsx content:
/* eslint-disable */
import { defineComponent } from "vue";
import B from "./B";
export default defineComponent({
props: {
aProps: String
},
render() {
const props = {
props: {
bProps: "bb"
}
};
return <B {...props} />;
}
});
- B.tsx,content
import { defineComponent } from "vue";
export default defineComponent({
props: {
bProps: String
},
render() {
return <h1>bb</h1>;
}
});
- in A.tsx, render function's return
<B
will report an error
What is expected?
when use spread props, there is no type error
What is actually happening?
defineComponent's return type may not support using spread props (like this: <B {...bProps}) />)