From 81b0341588cfbf44ea226bece2228bad1c202d65 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 9 Jul 2024 12:55:09 -0400 Subject: [PATCH 1/2] build: Remove dom types from main tsconfig --- dev-packages/node-integration-tests/tsconfig.test.json | 3 +++ packages/angular/tsconfig.ngc.json | 2 +- packages/browser-utils/tsconfig.json | 2 +- packages/browser/tsconfig.json | 2 +- packages/core/tsconfig.test.json | 1 + packages/ember/tsconfig.json | 1 + packages/gatsby/tsconfig.json | 1 + packages/react/tsconfig.json | 1 + packages/remix/tsconfig.test.json | 1 + packages/replay-canvas/tsconfig.json | 1 + packages/replay-canvas/tsconfig.test.json | 1 + packages/replay-internal/tsconfig.json | 1 + packages/solid/tsconfig.json | 4 +++- packages/svelte/tsconfig.json | 4 +++- packages/typescript/tsconfig.json | 2 +- packages/vercel-edge/tsconfig.json | 5 ++++- packages/vue/tsconfig.json | 2 +- packages/wasm/tsconfig.json | 2 +- 18 files changed, 27 insertions(+), 9 deletions(-) diff --git a/dev-packages/node-integration-tests/tsconfig.test.json b/dev-packages/node-integration-tests/tsconfig.test.json index 5a37b90c4fe2..3bd3452a3ead 100644 --- a/dev-packages/node-integration-tests/tsconfig.test.json +++ b/dev-packages/node-integration-tests/tsconfig.test.json @@ -4,6 +4,9 @@ "include": ["suites/**/*.ts"], "compilerOptions": { + // Although this seems wrong to include `DOM` here, it's necessary to make + // global fetch available in tests in lower Node versions. + "lib": ["DOM", "ES2018"], // should include all types from `./tsconfig.json` plus types for all test frameworks used "types": ["node", "jest"] diff --git a/packages/angular/tsconfig.ngc.json b/packages/angular/tsconfig.ngc.json index e915bd8cc32c..df29c7ffdfee 100644 --- a/packages/angular/tsconfig.ngc.json +++ b/packages/angular/tsconfig.ngc.json @@ -7,7 +7,7 @@ "compilerOptions": { "target": "es2018", "declarationMap": false, - "lib": ["dom", "es2018"], + "lib": ["DOM", "ES2018"], "baseUrl": "./" }, "angularCompilerOptions": { diff --git a/packages/browser-utils/tsconfig.json b/packages/browser-utils/tsconfig.json index bf45a09f2d71..6d1756d12826 100644 --- a/packages/browser-utils/tsconfig.json +++ b/packages/browser-utils/tsconfig.json @@ -4,6 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - // package-specific options + "lib": ["DOM", "ES2018"], } } diff --git a/packages/browser/tsconfig.json b/packages/browser/tsconfig.json index f88d8939acf7..6b204e508047 100644 --- a/packages/browser/tsconfig.json +++ b/packages/browser/tsconfig.json @@ -4,6 +4,6 @@ "include": ["src/**/*", "test/loader.js"], "compilerOptions": { - // package-specific options + "lib": ["DOM", "ES2018"], } } diff --git a/packages/core/tsconfig.test.json b/packages/core/tsconfig.test.json index 87f6afa06b86..6fde53bec436 100644 --- a/packages/core/tsconfig.test.json +++ b/packages/core/tsconfig.test.json @@ -4,6 +4,7 @@ "include": ["test/**/*"], "compilerOptions": { + "lib": ["DOM", "ES2018"], // should include all types from `./tsconfig.json` plus types for all test frameworks used "types": ["node", "jest"] diff --git a/packages/ember/tsconfig.json b/packages/ember/tsconfig.json index 95bb38c78628..584a13e19669 100644 --- a/packages/ember/tsconfig.json +++ b/packages/ember/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "target": "es2022", + "lib": ["DOM", "ES2022"], "allowJs": true, "moduleResolution": "node", "allowSyntheticDefaultImports": true, diff --git a/packages/gatsby/tsconfig.json b/packages/gatsby/tsconfig.json index b2c40b91a630..77d5f63b9345 100644 --- a/packages/gatsby/tsconfig.json +++ b/packages/gatsby/tsconfig.json @@ -4,6 +4,7 @@ "include": ["src/**/*"], "compilerOptions": { + "lib": ["DOM", "ES2018"], // package-specific options "jsx": "react" } diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index f074f990a911..67260f799e86 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -4,6 +4,7 @@ "include": ["src/**/*"], "compilerOptions": { + "lib": ["DOM", "ES2018"], // package-specific options "esModuleInterop": true, "jsx": "react" diff --git a/packages/remix/tsconfig.test.json b/packages/remix/tsconfig.test.json index ffcc2b26016c..3d6564a39ff5 100644 --- a/packages/remix/tsconfig.test.json +++ b/packages/remix/tsconfig.test.json @@ -4,6 +4,7 @@ "include": ["test/**/*", "vitest.config.ts"], "compilerOptions": { + "lib": ["DOM", "ES2018"], "types": ["node", "jest"], "esModuleInterop": true } diff --git a/packages/replay-canvas/tsconfig.json b/packages/replay-canvas/tsconfig.json index f8f54556da93..cd1b8207ea06 100644 --- a/packages/replay-canvas/tsconfig.json +++ b/packages/replay-canvas/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "lib": ["DOM", "ES2018"], "module": "esnext" }, "include": ["src/**/*.ts"] diff --git a/packages/replay-canvas/tsconfig.test.json b/packages/replay-canvas/tsconfig.test.json index ad87caa06c48..3995d3e18e59 100644 --- a/packages/replay-canvas/tsconfig.test.json +++ b/packages/replay-canvas/tsconfig.test.json @@ -4,6 +4,7 @@ "include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"], "compilerOptions": { + "lib": ["DOM", "ES2018"], "types": ["node", "jest"], "esModuleInterop": true, "allowJs": true, diff --git a/packages/replay-internal/tsconfig.json b/packages/replay-internal/tsconfig.json index f8f54556da93..cd1b8207ea06 100644 --- a/packages/replay-internal/tsconfig.json +++ b/packages/replay-internal/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "lib": ["DOM", "ES2018"], "module": "esnext" }, "include": ["src/**/*.ts"] diff --git a/packages/solid/tsconfig.json b/packages/solid/tsconfig.json index b0eb9ecb6476..6d1756d12826 100644 --- a/packages/solid/tsconfig.json +++ b/packages/solid/tsconfig.json @@ -3,5 +3,7 @@ "include": ["src/**/*"], - "compilerOptions": {} + "compilerOptions": { + "lib": ["DOM", "ES2018"], + } } diff --git a/packages/svelte/tsconfig.json b/packages/svelte/tsconfig.json index b0eb9ecb6476..6d1756d12826 100644 --- a/packages/svelte/tsconfig.json +++ b/packages/svelte/tsconfig.json @@ -3,5 +3,7 @@ "include": ["src/**/*"], - "compilerOptions": {} + "compilerOptions": { + "lib": ["DOM", "ES2018"], + } } diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index bee7b140cf96..4281e8d08380 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -7,7 +7,7 @@ "importHelpers": true, "inlineSources": true, "isolatedModules": true, - "lib": ["es2018", "dom"], + "lib": ["ES2018"], "moduleResolution": "node", "noErrorTruncation": true, "noFallthroughCasesInSwitch": true, diff --git a/packages/vercel-edge/tsconfig.json b/packages/vercel-edge/tsconfig.json index f288bd1b84e2..fc8caeb42e65 100644 --- a/packages/vercel-edge/tsconfig.json +++ b/packages/vercel-edge/tsconfig.json @@ -4,7 +4,10 @@ "include": ["src/**/*"], "compilerOptions": { - // package-specific options + // Note: using `dom` here is inaccurate for the vercel-edge runtime, but needed + // because @edge-runtime/types does not type things like fetch or RequestInit + // ref: https://github.com/vercel/edge-runtime/issues/506 + "lib": ["DOM", "ES2018"], "types": ["@edge-runtime/types"] } } diff --git a/packages/vue/tsconfig.json b/packages/vue/tsconfig.json index bf45a09f2d71..6d1756d12826 100644 --- a/packages/vue/tsconfig.json +++ b/packages/vue/tsconfig.json @@ -4,6 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - // package-specific options + "lib": ["DOM", "ES2018"], } } diff --git a/packages/wasm/tsconfig.json b/packages/wasm/tsconfig.json index bf45a09f2d71..6d1756d12826 100644 --- a/packages/wasm/tsconfig.json +++ b/packages/wasm/tsconfig.json @@ -4,6 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - // package-specific options + "lib": ["DOM", "ES2018"], } } From caaac04e99cc89048cfa58a349ce5ee346588b6a Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 10 Jul 2024 09:41:26 -0400 Subject: [PATCH 2/2] add to node-integration-tests --- dev-packages/node-integration-tests/suites/tsconfig.json | 6 ++++++ dev-packages/node-integration-tests/tsconfig.json | 3 +++ 2 files changed, 9 insertions(+) diff --git a/dev-packages/node-integration-tests/suites/tsconfig.json b/dev-packages/node-integration-tests/suites/tsconfig.json index 120c3aff3716..c8f7f2d29f65 100644 --- a/dev-packages/node-integration-tests/suites/tsconfig.json +++ b/dev-packages/node-integration-tests/suites/tsconfig.json @@ -1,3 +1,9 @@ { "extends": "../tsconfig.test.json", + + "compilerOptions": { + // Although this seems wrong to include `DOM` here, it's necessary to make + // global fetch available in tests in lower Node versions. + "lib": ["DOM", "ES2018"], + } } diff --git a/dev-packages/node-integration-tests/tsconfig.json b/dev-packages/node-integration-tests/tsconfig.json index 92db70d5ca09..9ef29d983a08 100644 --- a/dev-packages/node-integration-tests/tsconfig.json +++ b/dev-packages/node-integration-tests/tsconfig.json @@ -4,6 +4,9 @@ "include": ["utils/**/*.ts", "src/**/*.ts"], "compilerOptions": { + // Although this seems wrong to include `DOM` here, it's necessary to make + // global fetch available in tests in lower Node versions. + "lib": ["DOM", "ES2018"], // package-specific options "esModuleInterop": true, "types": ["node", "jest"]