setup expose, component should have typescript declaration
import { defineComponent, ref, Ref } from 'vue';
const Hello = defineComponent({
props: { msg: String },
setup: (props, { expose }) => {
const count: Ref<number> = ref(0);
expose({ a: 1, b: 2 });
return () => <div>{count.value} </div>;
},
});
declare const hello: InstanceType<typeof Hello>;
a
and b
are not exposed.
releated issue: https://github.com/vuejs/vue-next/issues/4397
Duplicate of https://github.com/vuejs/vue-next/issues/4397 Don't skip the issue template