Open zch233 opened 5 months ago
hi, can i work on this issue?
Try this it's working, This issue file is not presented in the project?
import { ref, defineComponent, SetupContext } from 'vue';
export default defineComponent( <T extends string | number>(props: { msg: T; list: T[] }, context: SetupContext) => { const count = ref(0); console.log(props, context),
return () => {
return <div>{count.value}</div>;
};
}, { props: ['msg', 'list'], } );
@zch233
不需要指定T类型,你可以看下这个函数类型定义。
https://github.com/vuejs/core/blob/main/packages/runtime-core/src/apiDefineComponent.ts#L123-L154
same problem and "generics" don't work
Vue version
3.4.21
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-rcbytc?file=src%2Fcomponents%2FHelloWorld.tsx
Steps to reproduce
when i used Function Signature with error
What is expected?
No errors
What is actually happening?
Parameter 'context' implicitly has an 'any' type
System Info
Any additional comments?
No response