CSSType
Strict TypeScript and Flow type definitions for CSS properties and values, generated from MDN data
Repository Health
Technical Analysis
CSSType is a pure type-definitions package that provides strict TypeScript and Flow types for every CSS property and value, generated directly from MDN’s browser-compat-data. Importing CSS.Properties gives autocomplete and compile-time type checking on style objects, catching typos in property names (colour instead of color) and invalid values (middle instead of center for textAlign) before code ever runs.
Because its types are mechanically generated from MDN’s authoritative CSS data rather than hand-maintained, CSSType stays current with the CSS spec and is widely depended upon as the underlying type source for CSS-in-JS libraries, style-object APIs, and any TypeScript/Flow codebase that models CSS properties as typed objects.
What You Get
CSS.Propertiestype covering every standard CSS property with its valid value union- At-rule types (
AtRule.Viewport, etc.) and pseudo-class/pseudo-element types for advanced selector typing - Both TypeScript (
index.d.ts) and Flow (index.js.flow) type definitions maintained in lockstep - Generic type parameters (e.g.
CSS.Properties<TLength>) for customizing how length/numeric values are typed - Types generated from and kept in sync with MDN’s
browser-compat-dataandmdn-datapackages rather than hand-authored
Common Use Cases
- Typing CSS-in-JS style objects in libraries like styled-components or Emotion, which depend on CSSType as their underlying property/value types
- Catching CSS property name typos and invalid values at compile time in TypeScript or Flow projects that build style objects programmatically
- Building design-system or component-library APIs that accept typed
styleprops validated against real CSS property/value unions - Powering autocomplete for CSS property names and values in editors via TypeScript’s language service
Under The Hood
Architecture CSSType has no runtime code at all — its main field is intentionally empty and the published package consists solely of index.d.ts (TypeScript, ~22,500 lines) and index.js.flow (Flow). The repository’s actual logic lives in its build tooling (build.ts, update.ts, src/), which reads MDN’s browser-compat-data and mdn-data npm packages, maps each CSS property to its accepted value grammar, and mechanically generates the massive type-definition file rather than having a human write or maintain thousands of property/value union types by hand.
Tech Stack The generator toolchain is TypeScript-based, running via tsx, and depends on mdn-data, @mdn/browser-compat-data, and css-tree to parse and interpret CSS grammar data pulled from MDN. Testing runs through Jest across both src (generator logic) and dist (generated output) test suites, and releases are automated via release-it.
Code Quality The __tests__ directory and dual test:src/test:dist Jest scripts indicate the project tests both its generation logic and the correctness of its final generated types against real style objects, which matters a great deal given the definitions file is nearly entirely machine-generated and any generator bug would silently propagate into thousands of type errors (or missed errors) downstream. The generated index.d.ts itself is not hand-reviewable line by line, so quality here is really a function of the generator’s own test coverage and its fidelity to MDN’s compatibility data.
API Design Consumer-facing usage is minimal by design: import type * as CSS from 'csstype' and reference CSS.Properties (optionally parameterized, e.g. CSS.Properties<string | number>, to control how length values are typed) — there is no configuration, no functions to call, and no runtime footprint, making adoption essentially zero-cost for any project that already uses TypeScript or Flow.
Used by 16 apps in this directory
OpenBB
Analytics · Databases · Invoicing Finance
The AI Workspace for Finance: Connect Data, Run AI Agents, Build Analytics
OpenReplay
Analytics
Self-hosted session replay and product analytics suite that lets you see exactly what users do on your web app — without sending data to third parties.
Payload CMS
Blogging · CMS · Developer Tools
The open-source, Next.js-native headless CMS that lives inside your /app folder and gives you a full TypeScript backend instantly.
Plasmic
CMS · Design Tools · Low Code Platforms
The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.
Teleport
Authentication · Security
Zero-trust infrastructure access platform that replaces credentials and VPNs with short-lived certificates, SSO, and identity-aware proxies for SSH, Kubernetes, databases, RDP, and AI agents.
Vikunja
Project Management
Self-hosted task management with natural-language quick-add, multiple views, and a fully documented REST API — your tasks, your infrastructure, zero lock-in.
Webiny JS
Blogging · CMS · Ecommerce
Open-source, self-hosted CMS on AWS serverless — a TypeScript framework you extend with code, not a product you configure through a UI.