From ee0491e9376342e839578758bfafeeb212c803e8 Mon Sep 17 00:00:00 2001 From: camc314 <18101008+camc314@users.noreply.github.com> Date: Fri, 6 Mar 2026 14:46:23 +0000 Subject: [PATCH] fix(apps,napi): explicitly specify libs in tsconfigs (#20071) Replaces #20064 The `dom` lib was implicitly being injected, this means stuff like `Token` and `Comment` were in the global scope, which was incorrect. cc @overlookmotel --- .gitignore | 1 + apps/oxfmt/tsconfig.json | 1 + apps/oxlint/tsconfig.json | 1 + napi/minify/tsconfig.json | 1 + napi/parser/tsconfig.browser.json | 19 +++++++++++++++++++ napi/parser/tsconfig.json | 11 ++--------- napi/parser/tsconfig.node.json | 14 ++++++++++++++ napi/transform/tsconfig.json | 1 + 8 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 napi/parser/tsconfig.browser.json create mode 100644 napi/parser/tsconfig.node.json diff --git a/.gitignore b/.gitignore index a22c530d36fd7..f709e8c42fe67 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ target/ /tasks/e2e/tests/nestjs/node_modules/ /npm/*/node_modules /napi/*/npm-dir +/napi/parser/tsconfig.browser.tsbuildinfo # Cloned conformance repos tasks/coverage/babel/ diff --git a/apps/oxfmt/tsconfig.json b/apps/oxfmt/tsconfig.json index b9adf01c95b3d..7c201c50ab2b8 100644 --- a/apps/oxfmt/tsconfig.json +++ b/apps/oxfmt/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "lib": ["ESNext"], "module": "Preserve", "moduleResolution": "Bundler", "noEmit": true, diff --git a/apps/oxlint/tsconfig.json b/apps/oxlint/tsconfig.json index 66934b7401aae..eebc3169ba29f 100644 --- a/apps/oxlint/tsconfig.json +++ b/apps/oxlint/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "lib": ["ESNext"], "module": "Preserve", "moduleResolution": "Bundler", "noEmit": true, diff --git a/napi/minify/tsconfig.json b/napi/minify/tsconfig.json index 24aeb5fd4f51e..8a377549cd7e5 100644 --- a/napi/minify/tsconfig.json +++ b/napi/minify/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "lib": ["ESNext"], "module": "Preserve", "moduleResolution": "Bundler", "noEmit": true, diff --git a/napi/parser/tsconfig.browser.json b/napi/parser/tsconfig.browser.json new file mode 100644 index 0000000000000..241df0505e7ea --- /dev/null +++ b/napi/parser/tsconfig.browser.json @@ -0,0 +1,19 @@ +{ + "extends": "./tsconfig.node.json", + "compilerOptions": { + "composite": true, + "declaration": true, + "emitDeclarationOnly": true, + "declarationDir": "./.tsbuild/browser", + "lib": [ + "ESNext", + "DOM", + "DOM.Iterable", + "DOM.AsyncIterable", + "WebWorker.ImportScripts", + "ScriptHost" + ] + }, + "include": ["test-browser/**/*.ts", "vitest.config.browser.ts"], + "exclude": [] +} diff --git a/napi/parser/tsconfig.json b/napi/parser/tsconfig.json index 3d380a9be514e..052a324e14cbd 100644 --- a/napi/parser/tsconfig.json +++ b/napi/parser/tsconfig.json @@ -1,11 +1,4 @@ { - "compilerOptions": { - "module": "Preserve", - "moduleResolution": "Bundler", - "noEmit": true, - "target": "ESNext", - "allowImportingTsExtensions": true, - "noUnusedLocals": true, - "strict": false - } + "files": [], + "references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.browser.json" }] } diff --git a/napi/parser/tsconfig.node.json b/napi/parser/tsconfig.node.json new file mode 100644 index 0000000000000..7bd200d1be05c --- /dev/null +++ b/napi/parser/tsconfig.node.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "lib": ["ESNext"], + "module": "Preserve", + "moduleResolution": "Bundler", + "noEmit": true, + "target": "ESNext", + "allowImportingTsExtensions": true, + "noUnusedLocals": true, + "skipLibCheck": true, + "strict": false + }, + "exclude": ["test-browser", "vitest.config.browser.ts"] +} diff --git a/napi/transform/tsconfig.json b/napi/transform/tsconfig.json index 24aeb5fd4f51e..8a377549cd7e5 100644 --- a/napi/transform/tsconfig.json +++ b/napi/transform/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "lib": ["ESNext"], "module": "Preserve", "moduleResolution": "Bundler", "noEmit": true,