CSSType provides comprehensive TypeScript and Flow type definitions for CSS properties and values, meticulously generated from MDN data. It is currently at version 3.2.3 and maintains an active release cadence, frequently updating its definitions to reflect the latest CSS specifications and browser compatibility data. Key differentiators include its strict adherence to MDN, support for various property naming conventions (camelCase for JavaScript, kebab-case for CSS-in-JS libraries), and inclusion of fallback array types for properties that accept multiple values. It covers standard, vendor-prefixed, obsolete, and SVG-specific properties, along with at-rule and pseudo-class/element types, offering robust type checking and autocompletion for web development projects.
npm install csstypeVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing `csstype` types, defining an interface using CSS property types, and applying them within a styled object, highlighting type checking for property names and values.
Review the CSSType v3 migration guide on GitHub. Update import statements from specific sub-paths or direct exports to `import type * as CSS from 'csstype';` and then access types like `CSS.Properties` or `CSS.AtRule.Viewport`.
Consult MDN Web Docs for the correct and accepted values for the CSS property causing the error. Ensure all values conform to the formal CSS syntax.
Select the interface that matches your styling approach: `Properties` for camelCase JS objects, `PropertiesHyphen` for kebab-case (often for React `style` prop or styled-components), and `Fallback` variants if you need to allow array values for fallbacks.
For individual custom properties, use type assertions like `{'--my-var': '10px' as CSS.Property.Width}`. For widespread usage, consider TypeScript module augmentation to extend `Properties` or related interfaces with your custom properties.Replace 'middle' with a valid CSS `text-align` value such as 'center', 'left', 'right', 'start', or 'end'.
Correct the property name to 'color', which is the standard CSS property for text color. CSSType follows the standard W3C and MDN property names.
Ensure you are using `import type * as CSS from 'csstype';` for all `csstype` imports to correctly reference type declarations without bundling runtime values. If the issue persists, explicitly annotate the type, e.g., `const style: CSS.Properties = { ... }`.No dependency data recorded yet.