|
@@ -5,34 +5,63 @@
|
|
|
|
|
|
/* TSConfig docs: https://aka.ms/tsconfig.json */
|
|
|
|
|
|
- /* Recommended target, lib and other settings for code running in the
|
|
|
- version of Node.js bundled with Electron.
|
|
|
-
|
|
|
- Currently, with Electron 25, this is Node.js 18
|
|
|
- https://www.electronjs.org/blog/electron-25-0
|
|
|
- */
|
|
|
- // "extends": "@tsconfig/node18/tsconfig.json",
|
|
|
"compilerOptions": {
|
|
|
+ /* Recommended target, lib and other settings for code running in the
|
|
|
+ version of Node.js bundled with Electron.
|
|
|
+
|
|
|
+ Currently, with Electron 25, this is Node.js 18
|
|
|
+ https://www.electronjs.org/blog/electron-25-0
|
|
|
+
|
|
|
+ Note that we cannot do
|
|
|
+
|
|
|
+ "extends": "@tsconfig/node18/tsconfig.json",
|
|
|
+
|
|
|
+ because that sets "lib": ["es2023"]. However (and I don't fully
|
|
|
+ understand what's going on here), that breaks our compilation since
|
|
|
+ tsc can then not find type definitions of things like ReadableStream.
|
|
|
+
|
|
|
+ Adding "dom" to "lib" (e.g. `"lib": ["es2023", "dom"]`) fixes the
|
|
|
+ issue, but that doesn't sound correct - the main Electron process
|
|
|
+ isn't running in a browser context.
|
|
|
+
|
|
|
+ It is possible that we're using some of the types incorrectly. For
|
|
|
+ now, we just omit the "lib" definition and rely on the defaults for
|
|
|
+ the "target" we've chosen. This is also what the current
|
|
|
+ electron-forge starter does:
|
|
|
+
|
|
|
+ yarn create electron-app electron-forge-starter -- --template=webpack-typescript
|
|
|
+
|
|
|
+ Enhancement: Can revisit this later.
|
|
|
+
|
|
|
+ Refs:
|
|
|
+ - https://github.com/electron/electron/issues/27092
|
|
|
+ - https://github.com/electron/electron/issues/16146
|
|
|
+ */
|
|
|
+
|
|
|
+ "target": "es2022",
|
|
|
+ "module": "node16",
|
|
|
+
|
|
|
+ "esModuleInterop": true,
|
|
|
+ "skipLibCheck": true,
|
|
|
+
|
|
|
/* Emit the generated JS into `app/` */
|
|
|
"outDir": "app",
|
|
|
/* Generate source maps */
|
|
|
"sourceMap": true,
|
|
|
/* Allow absolute imports starting with src as root */
|
|
|
"baseUrl": "src",
|
|
|
- /* Allow imports of paths in node_modules */
|
|
|
+ /* Allow imports of paths from node_modules */
|
|
|
"paths": {
|
|
|
"*": ["node_modules/*"]
|
|
|
},
|
|
|
|
|
|
/* Temporary overrides to get things to compile with the older config */
|
|
|
- "target": "es2021",
|
|
|
- "module": "commonjs",
|
|
|
- "esModuleInterop": true,
|
|
|
"strict": false,
|
|
|
"noImplicitAny": true
|
|
|
|
|
|
/* Below is the state we want */
|
|
|
/* Enable these one by one */
|
|
|
+ // "strict": true,
|
|
|
|
|
|
/* Require the `type` modifier when importing types */
|
|
|
// "verbatimModuleSyntax": true
|