menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

styled-system

Style props for rapid UI development

Channels
Team

Unable to access `theme` inside of TS styled-system design system project

March 11, 2021 at 5:07pm

Unable to access `theme` inside of TS styled-system design system project

March 11, 2021 at 5:07pm
I have a React TS-based design system built with emotion, styled-system, and theme-ui and am encountering a TS error I can't seem to resolve. It seems like a simple fix, I just haven't been able to debug it...
I'm seeing the issue in packages/core/src/components/Divider/Divider.tsx on line 22.
The error is: Property 'colors' does not exist on type 'Theme'.
I'm trying to access theme in a styled component with:
background-color: ${({ theme }) => theme.colors.border};
I have contributing docs detailing how to clone and install and start the project. Or you can take a look at the project itself to get a quick understanding of the setup.
Typescript configuration isn't my strong suit, so if anyone could point me in the right direction I'd really appreciate it. Thanks!
No messages yet