You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Declaration.important getter type excludes its documented undefined value #2180
Declaration.important is declared as a boolean getter, but a parsed declaration without !important has undefined at runtime. The declaration documentation itself illustrates the undefined case.
Reproduced with PostCSS 8.5.31 and Node.js 26.
importpostcssfrom"postcss";postcss.parse("a { color: red }").walkDecls((declaration)=>{constimportant: boolean=declaration.important;console.log(important.valueOf());});
This type-checks with strict null checking, but throws Cannot read properties of undefined (reading 'valueOf') at runtime. Object.hasOwn(declaration, "important") is false for this input. With !important, the property is true.
Expected: the read type includes undefined, matching the existing documented runtime behavior. This would let strict TypeScript consumers handle the absent annotation correctly and prevent type-aware lint rules from incorrectly treating boolean normalization as redundant. No runtime behavior change is necessary.
Activity
ai commentedon Oct 30, 2026
Please, send PR
fix: include undefined in Declaration.important getter type (postcss#…