stitches-utils
stitches-utils copied to clipboard
Improve typing
It would be great if utils could be typed against the tokens.
Currently, it only displays the valid CSS Properties:
We have an issue opened in Stitches about improving this (https://github.com/modulz/stitches/issues/129), so we may need to wait. But something to keep in mind
hey @peduarte I wasn't 100% sure about the typing but this seems to be related to the way the util is being used in stitches.
If you check this playground you'll see that the tokens come back correctly as suggestions but that doesn't seem to propagate when is used in the react package.
I've tried using a more complex typing by using ICssPropToToken
which will actually give us the correct token scale based on the properties used in the utils. This is to make it more flexible as composeUtil
can be used to compose any property.
Do you know why is this not picking up the correct types? In theory this should work but could it be something with the way the config is injected in that function?
@braposo im not sure, would need to dig.
@christianalfoni any pointers? 😄
thanks for that @peduarte! My gut feeling is that the config is being passed as any
and that breaks the typing of ICssPropToToken
as far as I can see. This playground has the config as any
and you can see that there aren't any token suggestions now.
Hopefully @christianalfoni can help with that as well!