@ssh/csstypes
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

csstypes

csstypes provides a set of strict type definitions for CSS length and color values.

Installation

Add csstypes as a dev dependency:

pnpm install -D @ssh/csstypes # or npm/yarn, of course

Usage

See the documentation for a full list of available types.

import { CSSLength, CSSColor, PixelSize } from '@ssh/csstypes';

// Valid values
const length: CSSLength = '1em';
const color: CSSColor = 'red';
const pixels: PixelSize = '1px';

// Invalid values
const length2: CSSLength = '1px';
// Type '"1px"' is not assignable to type 'CSSLength'

const color2: CSSColor = '1px';
// Type '"1px"' is not assignable to type 'CSSColor'

const pixels2: PixelSize = '1em';
// Type '"1em"' is not assignable to type '`${number}px`'

Package Sidebar

Install

npm i @ssh/csstypes

Weekly Downloads

7

Version

1.1.0

License

MIT

Unpacked Size

6.82 kB

Total Files

3

Last publish

Collaborators

  • saescapa-slingshot
  • sanil