electron+react项目改为typescript

1.添加typescript依赖

yarn add typescript

2.修改tsconfig.json

 "isolatedModules": true =>  "isolatedModules": false

3.js文件全部改为ts或tsx扩展名

4.修改package.json入口

 "main": "main.js" =>  "main": "main.ts"

5.修改引用方法

默认的electronmain中const xxx = require(xxxx),改为

improt {app, BrowserWindow} from 'electron'

6.Cannot find type definition file or 'react' TS2688

yarn add @types/react