问题描述
假设一个 Vue 组件是这样写的
import { Vue,Component } from "vue-property-decorator";
// ...
@Component({
setup () {
const { something } = useComposable();
return { something }
}
})
export default class DummyComponent extends Vue {
doSomething(command: string) {
this.something // issue
}
}
这里有两个问题:
-
TS2339: Property 'something' does not exist on type 'DummyComponent'.
和 -
this.something
未输入。
添加索引签名 ([x: string]: any;
) 似乎是满足 linter / tsc 的糟糕解决方法,并且设置 setup 方法的返回类型并不能解决问题 #1。有没有正确的方法来做到这一点,还是我混合了不应该混合的东西。我敢肯定了不起的 Vue 开发人员想到了这一点?
满足tsc
的正确方法是什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)