core
core copied to clipboard
feat(runtime-core): support "exposed" type constraints via paradigm
You can use satisfies
operator with TypeScript 4.9 instead, to constraint exposed type. Also, please create an issue before PR.
For example:
defineComponent({
setup(props, { expose }) {
expose({
foo: 1,
} satisfies { foo: boolean })
},
})
@sxzz Thanks for the suggestion, but if I use typescript before version 4.9, my decision should be in the right direction, right?
@jason-chang Not really necessary.
defineComponent({
setup(props, { expose }) {
const exposed: Type = { foo: 1 }
expose(exposed)
},
})