【日常踩坑】模块的默认导出具有或正在使用专用名称 “Props”
Hongbusi opened this issue · comments
洪布斯 commented
问题背景
<script setup lang="ts">
interface Props {
title: string
}
defineProps<Props>() // Error:模块的默认导出具有或正在使用专用名称 “Props”。
</script>
解决方案
移除 composite:true
在 tsconfig.json 中,警告消失。详见:vuejs/language-tools#1232
问题原因
使用 pnpm create vite
初始化项目之后,嫌两个配置文件看起来过于多余,于是手动合并了 tsconfig.json
和 tsconfig.node.json
。
Vite 中关于修改 tsconfig.json 的讨论:
相关文档
https://www.typescriptlang.org/docs/handbook/project-references.html