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.

javascript
declare module '*.css' {}

That's usually all you need.

This tells TypeScript:

Any module whose filename ends with .css should be considered a valid module.

After adding the declaration, an import such as:

javascript
import 'mapbox-gl/dist/mapbox-gl.css'

will no longer produce the TypeScript error.

What Is declare module '*.css'?

The following declaration:

javascript
declare module '*.css' {}

is an ambient module declaration.

It doesn't load CSS, process CSS, or generate any JavaScript.

Share:

More in Technology

View category