Ask questionsStrongly typed theme property
I am using TypeScript and
ThemeProvider for my components, and I had a couple of questions:
First of all, my components are created using
map, so I used to assign a
key to each one, now I have put
ThemeProvider to be the top parent component, and hence I need to set the
key on that. I was just wondering does it hurt to do this? Or should I find a way to create a single
Since I'm using TypeScript, it would be very nice if I could somehow make my
props.theme property be strongly typed. Right now when I hover over
props.theme, I see that the type is
any. It would VERY nice if I could somehow define the type for the
theme property while not changing the inferred type for
Thank you, and the more I use this library, the more I find out how great it is!
Answer questions brendanmc6
@kettanaito Thank you for the solution, however your claim that "name matters not" for
styled-components.d.ts was misleading in my case.
In my project, naming the file
styled-components.d.ts was overwriting the entire module declaration.
I have to name it
styled.d.ts or put the declaration with my other global types inside
This behavior is in a fresh next.js typescript project with default configuration.
Otherwise, this works great, thank you!