We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a bit of a weird one, the way Pinceau handles media keys in tokens.config.ts is broken in Typescript 5 and above.
tokens.config.ts
In version 4, Typescript would distribute the keys from PinceauTheme['media'] into the PinceauMediaQueries union:
PinceauTheme['media']
PinceauMediaQueries
type PinceauMediaQueries = 'dark' | 'light' | 'initial' | (keyof PinceauTheme['media'] extends string ? keyof PinceauTheme['media'] : never); // ^? type PinceauMediaQueries = 'dark' | 'light' | 'initial' | 'tablet' | 'desktop' | etc...
In version 5, Typescript no longer distributes these, resulting in this type:
type PinceauMediaQueries = 'dark' | 'light' | 'initial' | (keyof PinceauTheme['media'] extends string ? keyof PinceauTheme['media'] : never); // ^? type PinceauMediaQueries = 'dark' | 'light' | 'initial' | ('tablet' | 'desktop' | etc...)
They are then no longer included as valid keys for a responsive token.
A simple fix would be to use keyof PinceauTheme['media'] & string as opposed to the current conditional. That appears to work in both 4.x and 5.x.
keyof PinceauTheme['media'] & string
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
This is a bit of a weird one, the way Pinceau handles media keys in
tokens.config.ts
is broken in Typescript 5 and above.In version 4, Typescript would distribute the keys from
PinceauTheme['media']
into thePinceauMediaQueries
union:In version 5, Typescript no longer distributes these, resulting in this type:
They are then no longer included as valid keys for a responsive token.
A simple fix would be to use
keyof PinceauTheme['media'] & string
as opposed to the current conditional. That appears to work in both 4.x and 5.x.The text was updated successfully, but these errors were encountered: