next.js
9857ed1e - fix: support TypeScript `noUncheckedSideEffectImports` for CSS imports (#88199)

Commit
64 days ago
fix: support TypeScript `noUncheckedSideEffectImports` for CSS imports (#88199) ## Summary This PR adds type declarations for plain CSS side-effect imports (`*.css`, `*.sass`, `*.scss`) to support TypeScript 5.6's `noUncheckedSideEffectImports` option. ### What? Added empty module declarations for non-module CSS imports in `packages/next/types/global.d.ts`: ```ts declare module '*.css' {} declare module '*.sass' {} declare module '*.scss' {} ``` ### Why? When users enable `noUncheckedSideEffectImports` in their tsconfig (introduced in TypeScript 5.6), they get errors like: ``` Type error: Cannot find module './globals.css' or its corresponding type declarations. ``` This option is becoming increasingly important as it may become the default in future TypeScript versions. ### How? Added empty module declarations similar to the existing declarations for `server-only` and `client-only`. Fixes #88197 ## Checklist - [x] Related issues linked using `Fixes #88197` - [x] Tests added - Extended existing `test/production/typescript-checked-side-effect-imports/` test suite - [x] Verified the test fails without the fix and passes with the fix ## Test Plan ```bash pnpm test-start test/production/typescript-checked-side-effect-imports/index.test.ts ``` --------- Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Author
Parents
Loading