我想定义一个函数,以便该函数使作为参数传递的对象的this
个属性可用.例如,以下是某人调用函数的方式:
const props = ['bar'];
myBarFunction(props, {
get foo() {
return fooify(this.bar)
}
});
Here, I would want the bar
property to be available in this
(normally typescript would throw an error complaining there is no bar
in this
).
Something similar seems possible in Vue's defineComponent. Though, I'm unsure how or if that could be implemented in TypeScript or if it's something provided by Vue's Volar extension.
Is there a way for a function like myBarFunction
to be declared?