ts-react 运行报错

ts+react

安装命令

全局安装react
npm install -g create-react-app

搭建ts框架
create-react-app ts-react --typescript

切换到ts-react并运行
yarn start

运行时报了如下错误

解决办法:将package.json中,"typescript": "~3.7.5"版本,更新ts到"typescript": "^3.8.3" npm install [email protected] -S

TypeScript error in E:/demo/ts/base-typescript/ts-react-basic/node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts(7,13):
'=' expected.  TS1005

     5 |  * LICENSE file in the root directory of this source tree.
     6 |  */
  >  7 | import type * as PrettyFormat from './types';
       |             ^
     8 | /**
     9 |  * Returns a presentation string of your `val` object
    10 |  * @param val any potential JavaScript object

猜你喜欢

转载自www.cnblogs.com/lisaShare/p/12573490.html