我已经传递了一个数组作为道具项,我在接口 Props 中给了它一个类型,当我尝试给它一个默认值时,我得到一个错误第四行我TS2322: Type 'never[]' is not assignable to type '(props: Readonly<Props>) => string[]'. \xc2\xa0\xc2\xa0Type 'never[]' provides no match for the signature '(props: Readonly<Props>): string[]'.
不确定我在这里做错了什么,因为这似乎适用于其他变量
<script setup lang="ts">\nimport {ref} from "vue";\n\ninterface Props {\n items?: Array<string>\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n items: []\n});\nlet selectedItem = ref(props.items[0])\n
Run Code Online (Sandbox Code Playgroud)\n