mikaelvesavuori / figmagic

Figmagic is the missing piece between DevOps and design: Generate design tokens, export graphics, and extract design token-driven React components from your Figma documents.
https://docs.figmagic.com
MIT License
813 stars 73 forks source link

Provide const assertion on tokens in TypeScript #110

Closed Peeja closed 3 years ago

Peeja commented 3 years ago

In the past, we've gotten a lot of value out of typing our token values as const. This means that in VS Code, for instance, the Intellisense will show you the values alongside the token names. Ideally, engineers never need to know the values when they're writing code, because they have the token name from the designer, but we've found that from time to time folks still have to look up a token by its value. We're using Figmagic to import our tokens into a shared library, and then using that library in multiple apps, so looking up a token name by value in the code means digging into the shared library's repo, while this change makes it possible in the editor where you're already working.

Before (no values available in Intellisense)

image

After (values available in Intellisense)

image

mikaelvesavuori commented 3 years ago

Also: A very good addition! Thanks for contributing. Upon merging, I will add your name to the contributors list if you don't mind?

Peeja commented 3 years ago

Happy to be on the list, thanks!

mikaelvesavuori commented 3 years ago

Looks good! Merging. This is part of version 4.2.21. Thanks again for your time and contribution!

sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication