请问ts 提示模块的默认导出具有或正在使用专用名称 是什么问题?

是vue3.0的项目 用vite + ts 构建 现在 ts 提示这个错误信息,求大佬指点怎么处理。

[{

"resource": "/D:/worker/caas/form/src/components/caasForm/CaasForm.vue",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "4082",
"severity": 8,
"message": "模块的默认导出具有或正在使用专用名称“CaasFormProps”。",
"source": "ts",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1

}]

image.png

{
    "compilerOptions": {
        "allowSyntheticDefaultImports": true,
        "baseUrl": "./",
        "composite": true,
        "esModuleInterop": true,
        "forceConsistentCasingInFileNames": true,
        "isolatedModules": true,
        "jsx": "preserve",
        "lib": ["esnext", "dom"],
        "module": "esnext",
        "moduleResolution": "node",
        "paths": {
            "@/*": ["src/*"]
        },
        "resolveJsonModule": true,
        "skipLibCheck": true,
        "sourceMap": true,
        "strict": true,
        "target": "esnext",
        "typeRoots": ["./node_modules/@types/", "./types"],
        "types": ["@types/node", "vite-plugin-svg-icons/client"],
        "useDefineForClassFields": true
    },
    "exclude": ["cacheDir", "node_modules", "src/assets/**/*"],
    "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "vite.config.ts"]
}
阅读 12.3k
1 个回答

我猜:这里导出了 interface CaasFormProps,然后当前这个文件名应该也是 CaasFormProps,所以会导出一个同名的组件,造成名称冲突

猜错了,再想想

查了一下,这句话的英文是

Default export of the module has or is using private name ...

解释一下,大概是说导出的东西使用了 CaasFormProps,但这个接口没导出,改一下,把依赖的这两个接口导出试试:

export interface Config { ... }
export interface CassFormProps { ... }

……使用英文可能查问题更容易一些。翻译有时候真的是……头痛!

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Microsoft
子站问答
访问
宣传栏