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