【解决方案】TS2300: Duplicate identifier
问题描述在编译执行 ts文件时,出现这个问题:$ tsc -p tsconfig-build.jsonnode_modules/react-scripts/lib/react-app.d.ts:55:18 - error TS2300: Duplicate identifier 'src'.55export default src;~~~src/custom.d.ts:3:183export de
·
问题描述
在编译执行 ts文件时,出现这个问题:
$ tsc -p tsconfig-build.json
node_modules/react-scripts/lib/react-app.d.ts:55:18 - error TS2300: Duplicate identifier 'src'.
55 export default src;
~~~
src/custom.d.ts:3:18
3 export default content;
~~~~~~~
'src' was also declared here.
src/custom.d.ts:3:18 - error TS2300: Duplicate identifier 'src'.
3 export default content;

解决方案
设置 allowSyntheticDefaultImports 、 skipLibCheck 即可。
具体操作,在 tsconfig.json 配置中,添加如下配置:
{
...,
"compilerOptions": {
...,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
}
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)