amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.93k stars 558 forks source link

Feature Request: Typescript token files support. #1391

Open hsjobeki opened 1 week ago

hsjobeki commented 1 week ago

When using typescript with

deno bun or node with the --experimental-strip-types (https://github.com/nodejs/node/pull/53725)

It is not required to transpile typescript into javascript anymore.

With style-dictionary it is possible to use javascript to generate style rules. such as I do.

I use typescript to proof that all my themes are consistent and for stability reasons.

source: ["build/*.*js"]

// src/dark.ts
import { light } from "../light/color.token.js";

// Let Typescript check that dark theme has the same values as light theme
type Dark = typeof light;

const dark: Dark = {...}

Unfortunately style dictionary cannot load my .ts files directly by using:

`source: ["src/*.*ts"]`

This would be much more convenient especially since all major runtimes do now support running typescript natively and i can run all my stuff without the intermediate step of transpiling everything.