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.

But these type definitions describe the JavaScript API of Mapbox GL, not every asset distributed with the package.

For example, TypeScript can understand Mapbox's JavaScript API:

javascript
import mapboxgl from 'mapbox-gl'

but that doesn't automatically tell TypeScript what to do with:

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

The CSS file is a static asset, not a TypeScript module containing type declarations.

Therefore, you need to tell TypeScript how to handle CSS imports.

How to Fix TypeScript CSS Import Errors

The most common solution is to create an ambient module declaration for CSS files.

Create a file called:

javascript
global.d.ts

Then add:

Share:

More in Technology

View category