Share:

How to Fix "Cannot Find Module or Type Declarations for Side-Effect Import" in TypeScript
Learn how to fix the TypeScript TS2882 error for CSS imports, understand noUncheckedSideEffectImports, and use declare module '*.css' in Next.js.
If you're using TypeScript with Next.js or React and see an error like:
Cannot find module 'mapbox-gl/dist/mapbox-gl.css'
or its corresponding type declarations. (TS2882)when importing a CSS file:
import 'mapbox-gl/dist/mapbox-gl.css'you're likely running into TypeScript's handling of side-effect imports and the noUncheckedSideEffectImports option.
The confusing part is that the application may still work correctly. Next.js can find the CSS file, the browser loads the stylesheet, and the application builds successfully in some configurations—yet TypeScript or your IDE reports an error.
Fortunately, the fix is usually straightforward.
In this guide, you'll learn:
- What a side-effect import is in TypeScript
- Why TypeScript reports this CSS import error
- What
noUncheckedSideEffectImportsdoes - How to fix TS2882 with
declare module '*.css' - How to configure
global.d.ts - The difference between wildcard and exact CSS module declarations
- Which approach is best for Next.js and React projects
What Causes the "Cannot Find Module or Type Declarations" Error?
Consider this common CSS import:
import 'mapbox-gl/dist/mapbox-gl.css'Share:
More in Technology
View category![Where & How to Buy Aged & Verified LinkedIn Accounts [2026 Updated]](/article-img.avif)
Where & How to Buy Aged & Verified LinkedIn Accounts [2026 Updated]
📍Telegram : Abusmms 📍Whatsapp : +1 (312) 533-8937 📍Email : abusmmteam@gmail.com 📍Facebook Page : Abusmm 📍Signal : +1 (682) 474-9468
READ ARTICLE
ERC-20, ERC-721, or ERC-1155? Choosing the Right Ethereum Token Standard for Your Business
Explore ERC-20, ERC-721, and ERC-1155 for Ethereum token development. Choose the right standard and get 30% off this Halloween with Developcoins.
READ ARTICLE

Is Anthropic Claude Certification Worth It for AI Professionals in 2026
Anthropic’s Claude Certification program offers four proctored exams (CCAO-F, CCDV-F, CCAR-F and CCAR-P) that validate skills for building and managing Claude solutions, from beginner to enterprise architect level. This article explains who benefits most, what the exams test, and how to prepare with original practice material instead of risky dumps.
READ ARTICLE