tokens-studio/sd-transforms

[Feature]: Provide access to original type

Closed this issue · 3 comments

What feature would you like?

The alignTypes function in the preprocessor overwrites the type (see https://github.com/tokens-studio/sd-transforms/blob/main/src/preprocessors/align-types.ts). It would be useful to get access to the original token studio type somehow. Currently we work around this by creating a preprocessor that runs before the token studio one and adds a originalTsType property.

Would you be available to contribute this feature?

  • Yes, I would like to contribute this

I think this makes sense yes, perhaps put it inside the $extensions.studio.tokens namespace since it's vendor-specific metadata.
Feel free to raise a PR!

Actually I'll handle this PR, this one is somewhat coupled to another fix I'm doing for types alignments, and adding props to the studio.tokens $extensions namespace requires changes to @tokens-studio/types package as well.

Edit: labelling as bug as well because it's related to the bug that not all types are aligned, and if we do and letterSpacing is aligned to "dimension", then the letterSpacing transform no longer applies to those tokens, which is a bug imo and warrants storing the originalType and matching that for this transform.

@jorenbroekema no worries thanks for the fast response!