From 804c1e4cbb0b93d9499b8db1550bb36e7f5b15f3 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Fri, 21 Jul 2023 13:27:40 +0200 Subject: [PATCH] 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 --- ghost/tsconfig.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ghost/tsconfig.json b/ghost/tsconfig.json index 23afce2315..e3363fcd79 100644 --- a/ghost/tsconfig.json +++ b/ghost/tsconfig.json @@ -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. */