Adds "module" to tsconfig.json (#2012)

This commit is contained in:
Mihovil Ilakovac 2024-05-08 11:57:31 +02:00 committed by GitHub
parent 1699862f22
commit 76580648bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 32 additions and 8 deletions

View File

@ -42,6 +42,9 @@ These changes improve code readability and lower the complexity of accessing use
These changes only apply to getting auth fields from the `user` object you receive from Wasp, for example in the `authRequired` enabled pages or `context.user` on the server. If you are fetching the user and auth fields with your own queries, you _can_ keep using most of the helpers. Read more [about using the auth helpers](https://wasp-lang.dev/docs/auth/entities#including-the-user-with-other-entities). These changes only apply to getting auth fields from the `user` object you receive from Wasp, for example in the `authRequired` enabled pages or `context.user` on the server. If you are fetching the user and auth fields with your own queries, you _can_ keep using most of the helpers. Read more [about using the auth helpers](https://wasp-lang.dev/docs/auth/entities#including-the-user-with-other-entities).
### 🐞 Bug fixes
- Update the `tsconfig.json` to make sure IDEs don't underline `import.meta.env` when users use client env vars.
### 🔧 Small improvements ### 🔧 Small improvements
- Improved the default loading spinner while waiting for the user to be fetched. - Improved the default loading spinner while waiting for the user to be fetched.

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.

View File

@ -5,6 +5,11 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"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 support
"jsx": "preserve", "jsx": "preserve",
"strict": true, "strict": true,

View File

@ -5,6 +5,11 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"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 support
"jsx": "preserve", "jsx": "preserve",
"strict": true, "strict": true,

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.
@ -37,4 +38,4 @@
// https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file // https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file
"outDir": ".wasp/phantom" "outDir": ".wasp/phantom"
} }
} }

View File

@ -5,6 +5,7 @@
// compiler. Proper TS compiler configuration in Wasp is coming soon :) // compiler. Proper TS compiler configuration in Wasp is coming soon :)
{ {
"compilerOptions": { "compilerOptions": {
"module": "esnext",
"target": "esnext", "target": "esnext",
// We're bundling all code in the end so this is the most appropriate option, // We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly. // it's also important for autocomplete to work properly.
@ -20,19 +21,21 @@
"esnext" "esnext"
], ],
"allowJs": true, "allowJs": true,
"types": [ "typeRoots": [
// This is needed to properly support Vitest testing with jest-dom matchers. // This is needed to properly support Vitest testing with jest-dom matchers.
// Types for jest-dom are not recognized automatically and Typescript complains // Types for jest-dom are not recognized automatically and Typescript complains
// about missing types e.g. when using `toBeInTheDocument` and other matchers. // about missing types e.g. when using `toBeInTheDocument` and other matchers.
"@testing-library/jest-dom" "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"
], ],
// Since this TS config is used only for IDE support and not for // Since this TS config is used only for IDE support and not for
// compilation, the following directory doesn't exist. We need to specify // compilation, the following directory doesn't exist. We need to specify
// it to prevent this error: // it to prevent this error:
// https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file // https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file
"outDir": "phantom", "outDir": ".wasp/phantom"
}, }
"exclude": [
"phantom"
],
} }