-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Description
Vue version
3.2.47
Link to minimal reproduction
Steps to reproduce
In options api, with defineComponent define data properties, and in the same properties, try to access other data properties. It will throw error saying:
Property "options" doesn't exist on type 'Function'.
Here is the code:
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
data() {
return {
metadata: {
options: [
{name: 'Tony', value: 'tony'},
{name: 'Loki', value: 'loki'}
]
},
selectedOne: this.metadata.options[0]
}
}
})
</script>
<template>
<h1>{{ selectedOne.name }}</h1>
</template>
What is expected?
No error is expected
What is actually happening?
Property "options" doesn't exist on type 'Function'. => this error is coming
System Info
System:
OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400 @ 2.60GHz
Memory: 8.65 GB / 15.40 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
Browsers:
Firefox: 112.0.1
npmPackages:
vue: ^3.2.47 => 3.2.47 Metadata
Metadata
Assignees
Labels
No labels