app/tsconfig.json: document when to bump compilerOptions, and rationale

This commit is contained in:
Ronan Jouchet 2021-05-29 20:07:38 -04:00
parent 2b780e6c67
commit 8801ca5150
1 changed files with 15 additions and 0 deletions

View File

@ -10,6 +10,21 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
// Here in app/tsconfig.json, we want to set the `target` and `lib` keys to
// the "best" values for the version of Node **coming with the chosen Electron**.
// Careful: we're *not* talking about Nativefier's (CLI) required Node version,
// we're talking about the version of the Node runtime **bundled with Electron**.
//
// Like in our main tsconfig.json, we want to be as conservative as possible,
// to support (as much as reasonable) users using old versions of Electron.
// Then, at some point, an app dependency (declared in app/package.json)
// will require a more recent Node, then it's okay to bump our app compilerOptions
// to what's supported by the more recent Node.
//
// TS doesn't offer any easy "preset" for this, so the best we have is to
// believe people who know which {syntax, library} parts of current EcmaScript
// are supported for the version of Node coming with the Electron being used,
// and use what they recommend. For the current Node version, I followed
// https://stackoverflow.com/questions/51716406/typescript-tsconfig-settings-for-node-js-10
// and 'dom' to tell tsc it's okay to use the URL object (which is in Node >= 7)
"target": "es2018",