@tokens-studio/types
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

Tokens Studio Types

NPM version badge License badge

This repository is a collection of type definitions relating to Tokens Studio.

It currently exports types for all the available types of Design Tokens, as they exist in the Tokens Studio Figma Plugin. It also includes some type definitions for things like the $themes.json schema, HSLA/RGBA values, color modifier options and composition tokens.

Installation

With NPM:

npm install @tokens-studio/types

Documentation

See our documentation site here

Usage

import { SingleTypographyToken } from '@tokens-studio/types';

function logTypographyToken(token: SingleTypographyToken) {
  // because token is properly typed, we get autocomplete
  // e.g. token.type will be typed as "typography"
  const { value } = token;
  if (typeof value === 'string') {
    console.log(value);
  } else {
    // due to proper type, we get these properties autosuggested properly
    console.log(`${value.fontWeight} ${value.fontSize}/${value.lineHeight} ${value.fontFamily}`);
  }
}

Package Sidebar

Install

npm i @tokens-studio/types

Weekly Downloads

36,552

Version

0.4.0

License

MIT

Unpacked Size

42.3 kB

Total Files

82

Last publish

Collaborators

  • lukefinch
  • andrewattokensstudio
  • jorenbroekema
  • popdrazvan
  • six7