theme-ui icon indicating copy to clipboard operation
theme-ui copied to clipboard

Proper typescript support

Open sashalavron opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Hi. I am frustrated with lack of proper typescript support. Official docs recommends to use get function to access theme properties. It seems very unsafe, because get method basically disables the whole typescript support - it allows me to access to non-existing value and doesn't provide the explicit return type. Also, the Theme type seems not very useful - it does not represent the exact theme, and all of the properties are optional. I even cant add my own color, because of type incompatibility (see the screenshot). Could you please recommend me something in this situation?

Describe the solution you'd like Allow user to extend / specify properly the exact Theme type. get function just workarounds the whole types and can cause a lot of bugs.

Additional context Cant extend the theme-ui with my own colors: image image

Cant specify my own theme type: image image

sashalavron avatar Jun 17 '21 12:06 sashalavron

https://theme-ui.com/guides/typescript/#typescript

Probably we can close this?Cc: @hasparus

MuhammadJamaluddin avatar Nov 25 '21 12:11 MuhammadJamaluddin