Closed m-yoshiro closed 1 year ago
Thank you for the question @m-yoshiro! That change was intentional because when Style Dictionary calls that function, it always passes in the platform configuration object, so we want the custom transformer functions to not have to do an undefined check in their transformer function. This does make calling the transformer function in a unit test a bit more difficult, but you can just add an empty object as the 2nd argument in your unit test.
I'm open to suggestions on how to improve the typing of this though.
Thank you for your explanations! I understand the reason and It's clear to me now.
Hello everyone,
I'm having a problem with
style-dictionary@3.8.0
and Typescript. When running tests in my project, this error occurred.I think the problem came from https://github.com/amzn/style-dictionary/pull/926, where
Transform.transformer
type was modified.options
argument has been added and its type is not optional.I'd like to ask if this behavior is intentional or not. Thanks!
p.s. I found that some
transfomer
's tests don't useoptions
argument, so I suppose it might be unintentional.https://github.com/amzn/style-dictionary/blob/2cf72f3f89996503608c238d7f3bcbab5b53e719/__tests__/common/transforms.test.js#L607-L610
In Addition, my
typographyToCss
's implementation and test code are like below.