amzn / style-dictionary

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

Missing `mapName` field on `File` type when using `scss` #1005

Closed ConcernedHobbit closed 5 months ago

ConcernedHobbit commented 1 year ago

You can use mapName when transforming scss tokens: https://github.com/amzn/style-dictionary/blob/2cf72f3f89996503608c238d7f3bcbab5b53e719/lib/common/templates/scss/map-flat.template#L19 https://github.com/amzn/style-dictionary/blob/2cf72f3f89996503608c238d7f3bcbab5b53e719/docs/formats.md?plain=1#L47

However, this is not reflected in File or Platform types, causing a TypeScript error.

jorenbroekema commented 6 months ago

Hmm I'm gonna refactor the templates into ES6 template literals, at that point the type checking for template files will kick in, I'll fix this type issue then 👍🏻

jorenbroekema commented 5 months ago

I recently fixed some of theses type issues and they were a consequence of some API inconsistencies in style-dictionary.

mapName should be put under "options" property of a file, see migration docs https://v4.styledictionary.com/version-4/migration/#formatting-options on this topic