From fa06eb3158a0d9863ead6643780b1fb01ff27af2 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 25 Apr 2022 08:32:45 +0100 Subject: [PATCH] docs: document why we have two tsconfigs --- server/tsconfig.build.json | 7 +++++++ server/tsconfig.json | 15 ++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/server/tsconfig.build.json b/server/tsconfig.build.json index e62e479af..582a4c1e2 100644 --- a/server/tsconfig.build.json +++ b/server/tsconfig.build.json @@ -1,3 +1,10 @@ +// This TSConfig file is used when pnpm build is ran. It omits out +// unecessary files, such as anything involved in testing. +// This is a separate TSConfig file because VSCode (by default) uses +// the exclude list to find out what it should care about for typechecking +// while writing code. +// Since I still want my tests to take advantage of static typing, this is +// a necessary hack. { "extends": "./tsconfig.json", "exclude": [ diff --git a/server/tsconfig.json b/server/tsconfig.json index d51a2a5ac..6db243cc1 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -1,16 +1,17 @@ -// NOT A REAL TSCONFIG FILE -// THIS IS USED FOR VSCODE SO IT INTEGRATES NICELY -// IF YOU USE THIS TO BUILD, IT WILL ALSO BUILD THE TEST FILES!! -// SO, DONT DO THAT, USE TSCONFIG.BUILD.JSON FOR THE BUILD. +// This is a base TSConfig for nice integration with IDEs such as VSCode. +// By default, VSCode reads `tsconfig.json` to know what it should typecheck +// in the editor. Since we want it to typecheck things like our tests, but +// we want to save disk space by not compiling them at runtime, we need two +// tsconfigs! { "compilerOptions": { "target": "ES2020", "module": "CommonJS", "lib": [ "ES2019", - // this is absolutely stupid, and only needed because the AWS SDK - // DEPENDS ON A DOM TYPE??? - // do people even run the aws sdk on the dom? + // This is necessary because -- for some unknown reason -- the AWS SDK + // depends on the DOM. Do people even run the AWS SDK in the browser? + // I hope not. "DOM" ], "declaration": true,