Top
Fork me on Gitee My Github

ts-react 运行报错

ts+react

如果感兴趣typescript的基础代码学习可以参考我的gitlab

安装命令

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

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

切换到ts-react并运行
yarn start

运行时报了如下错误

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

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

posted @ 2020-03-26 12:11  lisashare  阅读(670)  评论(0编辑  收藏  举报