1.添加typescript依賴react
yarn add typescripttypescript
2.修改tsconfig.jsonjson
"isolatedModules": true => "isolatedModules": false
3.js文件所有改成ts或tsx擴展名app
4.修改package.json入口electron
"main": "main.js" => "main": "main.ts"
5.修改引用方法ui
默認的electronmain中const xxx = require(xxxx),改成spa
improt {app, BrowserWindow} from 'electron'code
6.Cannot find type definition file or 'react' TS2688blog
yarn add @types/reactip