Skip to content

Commit 3ad3bdd

Browse files
authored
ref(typescript): Remove dom types from main tsconfig (#12836)
Remove `dom` types from `packages/typescript/tsconfig.json` and add it to the respective packages that need them. This is important because we should only be adding `dom` types to packages that will be used in the browser.
1 parent 2f04224 commit 3ad3bdd

File tree

20 files changed

+36
-9
lines changed

20 files changed

+36
-9
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
{
22
"extends": "../tsconfig.test.json",
3+
4+
"compilerOptions": {
5+
// Although this seems wrong to include `DOM` here, it's necessary to make
6+
// global fetch available in tests in lower Node versions.
7+
"lib": ["DOM", "ES2018"],
8+
}
39
}

dev-packages/node-integration-tests/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"include": ["utils/**/*.ts", "src/**/*.ts"],
55

66
"compilerOptions": {
7+
// Although this seems wrong to include `DOM` here, it's necessary to make
8+
// global fetch available in tests in lower Node versions.
9+
"lib": ["DOM", "ES2018"],
710
// package-specific options
811
"esModuleInterop": true,
912
"types": ["node", "jest"]

dev-packages/node-integration-tests/tsconfig.test.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"include": ["suites/**/*.ts"],
55

66
"compilerOptions": {
7+
// Although this seems wrong to include `DOM` here, it's necessary to make
8+
// global fetch available in tests in lower Node versions.
9+
"lib": ["DOM", "ES2018"],
710
// should include all types from `./tsconfig.json` plus types for all test frameworks used
811
"types": ["node", "jest"]
912

packages/angular/tsconfig.ngc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"compilerOptions": {
88
"target": "es2018",
99
"declarationMap": false,
10-
"lib": ["dom", "es2018"],
10+
"lib": ["DOM", "ES2018"],
1111
"baseUrl": "./"
1212
},
1313
"angularCompilerOptions": {

packages/browser-utils/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"include": ["src/**/*"],
55

66
"compilerOptions": {
7-
// package-specific options
7+
"lib": ["DOM", "ES2018"],
88
}
99
}

packages/browser/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"include": ["src/**/*", "test/loader.js"],
55

66
"compilerOptions": {
7-
// package-specific options
7+
"lib": ["DOM", "ES2018"],
88
}
99
}

packages/core/tsconfig.test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"include": ["test/**/*"],
55

66
"compilerOptions": {
7+
"lib": ["DOM", "ES2018"],
78
// should include all types from `./tsconfig.json` plus types for all test frameworks used
89
"types": ["node", "jest"]
910

packages/ember/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"target": "es2022",
5+
"lib": ["DOM", "ES2022"],
56
"allowJs": true,
67
"moduleResolution": "node",
78
"allowSyntheticDefaultImports": true,

packages/gatsby/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"include": ["src/**/*"],
55

66
"compilerOptions": {
7+
"lib": ["DOM", "ES2018"],
78
// package-specific options
89
"jsx": "react"
910
}

packages/react/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"include": ["src/**/*"],
55

66
"compilerOptions": {
7+
"lib": ["DOM", "ES2018"],
78
// package-specific options
89
"esModuleInterop": true,
910
"jsx": "react"

packages/remix/tsconfig.test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"include": ["test/**/*", "vitest.config.ts"],
55

66
"compilerOptions": {
7+
"lib": ["DOM", "ES2018"],
78
"types": ["node", "jest"],
89
"esModuleInterop": true
910
}

packages/replay-canvas/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4+
"lib": ["DOM", "ES2018"],
45
"module": "esnext"
56
},
67
"include": ["src/**/*.ts"]

packages/replay-canvas/tsconfig.test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"],
55

66
"compilerOptions": {
7+
"lib": ["DOM", "ES2018"],
78
"types": ["node", "jest"],
89
"esModuleInterop": true,
910
"allowJs": true,

packages/replay-internal/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4+
"lib": ["DOM", "ES2018"],
45
"module": "esnext"
56
},
67
"include": ["src/**/*.ts"]

packages/solid/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33

44
"include": ["src/**/*"],
55

6-
"compilerOptions": {}
6+
"compilerOptions": {
7+
"lib": ["DOM", "ES2018"],
8+
}
79
}

packages/svelte/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33

44
"include": ["src/**/*"],
55

6-
"compilerOptions": {}
6+
"compilerOptions": {
7+
"lib": ["DOM", "ES2018"],
8+
}
79
}

packages/typescript/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"importHelpers": true,
88
"inlineSources": true,
99
"isolatedModules": true,
10-
"lib": ["es2018", "dom"],
10+
"lib": ["ES2018"],
1111
"moduleResolution": "node",
1212
"noErrorTruncation": true,
1313
"noFallthroughCasesInSwitch": true,

packages/vercel-edge/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"include": ["src/**/*"],
55

66
"compilerOptions": {
7-
// package-specific options
7+
// Note: using `dom` here is inaccurate for the vercel-edge runtime, but needed
8+
// because @edge-runtime/types does not type things like fetch or RequestInit
9+
// ref: https://github.com/vercel/edge-runtime/issues/506
10+
"lib": ["DOM", "ES2018"],
811
"types": ["@edge-runtime/types"]
912
}
1013
}

packages/vue/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"include": ["src/**/*"],
55

66
"compilerOptions": {
7-
// package-specific options
7+
"lib": ["DOM", "ES2018"],
88
}
99
}

packages/wasm/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"include": ["src/**/*"],
55

66
"compilerOptions": {
7-
// package-specific options
7+
"lib": ["DOM", "ES2018"],
88
}
99
}

0 commit comments

Comments
 (0)