--- title: Enable Strict CSS Modules Type Checking impact: MEDIUM impactDescription: catches typos in CSS module class names at compile time type: capability tags: strictCssModules, vueCompilerOptions, css-modules, style-module --- # Enable Strict CSS Modules Type Checking **Impact: MEDIUM** - catches typos in CSS module class names at compile time When using CSS modules with ` ``` The typo `buttn` instead of `button` silently fails at runtime. ## Solution Enable `strictCssModules` in your tsconfig: ```json // tsconfig.json or tsconfig.app.json { "vueCompilerOptions": { "strictCssModules": true } } ``` Now `$style.buttn` will show a type error because `buttn` doesn't exist in the CSS module. ## What Gets Checked | Access | With strictCssModules | |--------|----------------------| | `$style.validClass` | OK | | `$style.typo` | Error: Property 'typo' does not exist | | `$style['dynamic']` | OK (dynamic access not checked) | ## Limitations - Only checks static property access (`$style.className`) - Dynamic access (`$style[variable]`) is not validated - Only works with `