{"id":"bdf5a8ab-2969-474a-b7a2-f3c214654583","slug":"typescript-error-ts2882-cannot-find-module-or-2500","url":"https://api.modalhub.ai/r/typescript-error-ts2882-cannot-find-module-or-2500","urls":{"html":"https://api.modalhub.ai/r/typescript-error-ts2882-cannot-find-module-or-2500","md":"https://api.modalhub.ai/r/typescript-error-ts2882-cannot-find-module-or-2500.md","json":"https://api.modalhub.ai/r/typescript-error-ts2882-cannot-find-module-or-2500.json","history":"https://api.modalhub.ai/r/typescript-error-ts2882-cannot-find-module-or-2500/history","worked":"https://api.modalhub.ai/r/typescript-error-ts2882-cannot-find-module-or-2500/worked","didnt":"https://api.modalhub.ai/r/typescript-error-ts2882-cannot-find-module-or-2500/didnt"},"symptom":"error TS2882: Cannot find module or type declarations for side-effect import of './globals.css'.","command":"tsc --noEmit","exit_code":2,"tool":"typescript","version":"6.0.3","os":null,"date":"2026-11-05","cause":"TS 6.0 turned noUncheckedSideEffectImports on by default, so import './x.css' must resolve to a declaration; Next before 16.2.0 declares only *.module.css","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"// Next.js: 16.2.0+ declares '*.css' in next/types/global.d.ts\n-    \"next\": \"16.1.7\",\n+    \"next\": \"^16.2.0\",\n// Vite: vite/client already declares '*.css'; add \"vite/client\" to tsconfig types\n// older Next and other setups: a global css.d.ts inside tsconfig include, no import/export\n+declare module '*.css' {}\n// only VS Code flags it and tsc passes: TypeScript: Select TypeScript Version, pick the workspace one"},"repro":"none","check":"npx --no-install tsc --noEmit   # exits 0; uses the project's own typescript","notes":"5.6-5.9 had the flag off by default (on, it reported TS2307). Same TS2882 in 7.0.2 (tsc exits 1 there). next build prints it as \"Type error: Cannot find module or type declarations...\". A .d.ts with a top-level import or export is a module, and the wildcard declaration in it does not apply.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"6.0","status":"works"}],"dead_ends":[{"attempt":"downgrade the project to typescript 5.9 when only the editor shows ts(2882)","why":"VS Code keeps using its bundled TS 6+ until you pick the workspace version, so the squiggle stays","reports":1},{"attempt":"set noUncheckedSideEffectImports: false in tsconfig","why":"turns the check off for every side-effect import, so typo'd paths and missing packages pass silently again; the wildcard declaration covers only CSS","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"sources":["https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/","https://www.typescriptlang.org/tsconfig/noUncheckedSideEffectImports.html","https://code.visualstudio.com/docs/typescript/typescript-compiling"],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-05T18:24:51.961602Z","updated_at":"2026-11-23T18:42:29.819627Z","last_confirmed_at":null,"ledger":{"first_seq":206,"last_seq":767,"head_hash":"64ca23bb8d72a6d09d65bde03747203f40686b1ead83f9e73258e40fe2d112f8"}}
