Skip to content
New issue

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

Misbehaving ThemeOverride definition #11

Open
Nicholaiii opened this issue Mar 8, 2021 · 0 comments
Open

Misbehaving ThemeOverride definition #11

Nicholaiii opened this issue Mar 8, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Nicholaiii
Copy link

The use of NonNullishPartialRecord in ThemeOverride only allows for Records as types, and forces all values of Records to be strings

This means that Records with number (or other) values like fontWeights do not work.

It also means that font, breakpoints and VariantValues (the latter two which should be, but aren't, defined on interface Theme) of types string, array or string literal respectively do not work (because they are not Records).
image

This can be fixed by adding breakpoints and VariantValues (and maybe other missing?) to the interface Theme, adding the type of the key to NonNullishPartialRecord and the plain type as a type:

export type NonNullishPartialRecord<K, V = string> =
{ [key in keyof K]?: K[key] } & { [key: string]: V } | K

Somewhat relatedly, you might also want to reconsider defining objects and exporting their types with typeof, and instead define interfaces for them, ensuring local type safety, but also some pretty cool options like instead of using string type for pixel values, you can do:

type Pixels = `${number}px`

I'm willing to give a hand with any and all of this, but I don't want to waste my time if you won't accept those changes :)

@dziraf dziraf added the bug Something isn't working label Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants