Closed
Description
<template>
<div></div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
data() {
return {
a: {
b: '',
},
};
},
computed: {
length() {
return this.a.b;
/**
* 类型“CreateComponentPublicInstance<{} | {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, {} | {}, {}, false, ... 6 more ..., {}>”上不存在属性“a”。
类型“{ $: ComponentInternalInstance; $data: {}; $props: {} | {}; $attrs: Data; $refs: Data; $slots: Readonly<InternalSlots>; ... 7 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & ... 4 more ... & ComponentCustomProperties”上不存在属性“a”。ts(2339)
*/
},
},
});
</script>
src/test.vue:18:19 - error TS2339: Property 'a' does not exist on type 'CreateComponentPublicInstance<{} | {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, {} | {}, {}, false, ... 6 more ..., {}>'.
Property 'a' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: {} | {}; $attrs: Data; $refs: Data; $slots: Readonly<InternalSlots>; ... 7 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & ... 4 more ... & ComponentCustomProperties'.
18 return this.a.b;
~