我在将TypeScript添加到现有的 create-react-app应用程序时遇到了困难.以前我总是在开始项目之前添加它,只是通过create-react-app my-app --scripts-version=react-scripts-ts
,但现在不起作用.
我在这里找到的唯一"解决方案" 是:
react-scripts-ts
tsconfig.json
,tsconfig.test.json
,tslint.json
从临时项目src文件夹到项目的src
文件夹中.package.json
,更改脚本部分中对react-scripts
to的所有引用react-scripts-ts
.这似乎是一个奇怪的解决方法,而且效率不高.有谁知道是否可以以比这更好的方式添加它?