From 5dd5a5076a501f8b34e7724d27224af8969bb376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Sodi=C4=87?= Date: Thu, 17 Apr 2025 01:21:54 +0200 Subject: [PATCH] Update tsconfig and vite-env.d.ts --- template/app/src/vite-env.d.ts | 6 ++++++ template/app/tsconfig.json | 28 ++++++++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/template/app/src/vite-env.d.ts b/template/app/src/vite-env.d.ts index 11f02fe2..0a1f512e 100644 --- a/template/app/src/vite-env.d.ts +++ b/template/app/src/vite-env.d.ts @@ -1 +1,7 @@ /// + +// This is needed to properly support Vitest testing with jest-dom matchers. +// Types for jest-dom are not recognized automatically and Typescript complains +// about missing types e.g. when using `toBeInTheDocument` and other matchers. +// Reference: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843 +import '@testing-library/jest-dom'; diff --git a/template/app/tsconfig.json b/template/app/tsconfig.json index a62a4ce9..ac792df1 100644 --- a/template/app/tsconfig.json +++ b/template/app/tsconfig.json @@ -11,32 +11,24 @@ { "compilerOptions": { "module": "esnext", - // Needed because this is used as a project reference. "composite": true, "target": "esnext", - // We're bundling all code in the end so this is the most appropriate option, - // it's also important for autocomplete to work properly. "moduleResolution": "bundler", - // JSX support "jsx": "preserve", "strict": true, - // Allow default imports. "esModuleInterop": true, - "lib": ["dom", "dom.iterable", "esnext"], + "isolatedModules": true, + "moduleDetection": "force", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "skipLibCheck": true, "allowJs": true, - "typeRoots": [ - // This is needed to properly support Vitest testing with jest-dom matchers. - // Types for jest-dom are not recognized automatically and Typescript complains - // about missing types e.g. when using `toBeInTheDocument` and other matchers. - "node_modules/@testing-library", - // Specifying type roots overrides the default behavior of looking at the - // node_modules/@types folder so we had to list it explicitly. - // Source 1: https://www.typescriptlang.org/tsconfig#typeRoots - // Source 2: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843 - "node_modules/@types" - ], "outDir": ".wasp/out/user" }, - "include": ["src"] + "include": [ + "src" + ] }