Globhy
AllBusinessHealthMarketingTechnologyTravelUncategorized
HAHartanto3 views
Posted on 03 Sep 2026Edited on 03 Sep 2026

Share:

How to Fix "Cannot Find Module or Type Declarations for Side-Effect Import" in TypeScript

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.

noUncheckedSideEffectImports in TypeScript 5.6

TypeScript 5.6 introduced the noUncheckedSideEffectImports compiler option to make this behavior stricter.

When enabled, TypeScript checks whether side-effect imports can be resolved.

This means an import such as:

javascript
import './styles.css'

must be resolvable from TypeScript's perspective.

If TypeScript cannot find the module or an appropriate declaration, you may see:

javascript
Cannot find module './styles.css'
or its corresponding type declarations.

The option is useful because it can catch genuine mistakes, but it also means TypeScript needs additional information for non-TypeScript assets such as CSS.

Why Doesn't @types/mapbox-gl Fix the Error?

You might think installing the Mapbox TypeScript definitions should solve the problem:

javascript
npm install -D @types/mapbox-gl

Share:

More in Technology

View category