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.
@types/mapbox-gl provides TypeScript definitions for the Mapbox JavaScript API. It does not necessarily declare Mapbox's distributed CSS files.
Does declare module '*.css' import the CSS?
No.
It only provides a declaration for TypeScript. Your framework or bundler is still responsible for loading and processing the CSS.
Will declare module '*.css' hide typos?
It can prevent TypeScript from detecting some invalid CSS paths because any .css module matches the wildcard.
However, the bundler still has to resolve the actual file during development or production builds.
Should I use declare module '*.css' in Next.js?
For most Next.js applications that import CSS assets from dependencies, it's a practical solution when TypeScript reports unresolved CSS side-effect imports.
What is TS2882?
TS2882 is the TypeScript diagnostic associated with an unresolved side-effect import when TypeScript's stricter side-effect import checking is enabled.
Conclusion
Share:
More in Technology
View category
MT5 clone solution for forex broker and trading companies
Explore how MT5 Clone Script solutions help forex brokers and trading firms build customizable trading platforms with advanced charts, order management, automation, liquidity integration, and security controls. Learn which features and technologies matter when planning a reliable trading platform for long-term growth.
READ ARTICLE

Second Hand Bike: How to Check, Choose & Buy Used Bikes
Buy used bikes online with Vutto. Browse verified second-hand motorcycles from trusted sellers, compare prices, check specifications, and find the perfect pre-owned bike at the best value.

Data Integration Market Transformation Driven by Unified Data Ecosystems
The Data Integration Market size was valued at USD 16.23 Bn in 2025. The Global Data Integration Market is estimated to grow at a CAGR of 11.23% over the forecast period.