How do you determine that an object is a component ?
What problem does this feature solve?
A vue component should have a render() or setup(){return ()=>{}}, but definComponent or some other API can pass an empty object. Obviously an empty object as a component doesn't make sense. If we only had setup, we would have to distinguish between a hook and a component
What does the proposed API look like?
function isComponent(value: any): value is Component {
if (value !== null && typeof value === 'object') {
return (!!value.__v_component || !!value.__v_functionalComponent);
}
return false;
}
defineHook(()=>{}) or defineHook({setup()=>{}}) defineComponent(()=>{}) or defineHook({setup()=>{}})
Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.
Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.
Isn't this a feature request. I put all my suggestions in there. I want you to take a look at it and not just think I'm asking a question
A vue component should have a render() or setup(){return ()=>{}}, but definComponent or some other API can pass an empty object. Obviously an empty object as a component doesn't make sense. If we only had setup, we would have to distinguish between a hook and a component