Configured imported types in tsconfig

refs https://github.com/TryGhost/DevOps/issues/45

- by default, `tsconfig` will load all `@types` packages
- this can slow down the build because it's loading unneeded files
- adding a value to `types` overrides "all", but we still want `node` to
  allow Node globals to be found with no extra effort
- similarly, we can limit `lib` to `es2022` to remove an extra 5 files
- this makes a `tsc` roughly 2x faster
This commit is contained in:
Daniel Lockyer 2023-07-21 13:27:40 +02:00 committed by Daniel Lockyer
parent cd175ddae2
commit 804c1e4cbb

View File

@ -15,7 +15,7 @@
/* Language and Environment */
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": ["es2019"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"lib": ["es2022"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
@ -35,7 +35,11 @@
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
"types": [
"jest",
"mocha",
"node",
], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */