You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last days I converted a library of mine from JavaScript to TypeScript. Everything works except for one thing: Previously I have used babel-plugin-styled-components to enable the css prop in my library. Everyone who used the library had to install styled-components as dependency therefore. Since I moved to TS, I read up that I had to use typescript-plugin-styled-components now.
So added it, rebuild and published the library, but got the following warning without the CSS being applied when using the library in a third-party project.
Warning: Invalid value for prop `css` on <div> tag.
A third-party minimal project where I use the library can be seen here. One can see in the console the warning and in the browser the non-styled HTML.
Let's get to the library which I upgraded to TS and which uses the typescript-plugin-styled-components package. The up-to-date implementation can be found here.
I use it in my rollup.config.js which is the following:
I am not a 100% sure about this, but I think the rollup configuration still picks up my .babelrc file where I still use babel-plugin-styled-components if that matters:
Essentially that's it. I hoped to get the CSS prop running again when I switched the library to TS, but whatever I do it doesn't work. Can anyone spot anything that's missing or wrongfully configured here? Very much appreciate any help that I can get here!
Not sure if related, but I also had to implement a styled.d.ts file in my library to please the type checking for the CSS prop:
Seems to be related to no css prop support. How difficult would it be to integrate it in this library @Igorbek ? Hard to tell from my perspective, because I am not super much into build tools unfortunately.
The last days I converted a library of mine from JavaScript to TypeScript. Everything works except for one thing: Previously I have used
babel-plugin-styled-components
to enable thecss
prop in my library. Everyone who used the library had to install styled-components as dependency therefore. Since I moved to TS, I read up that I had to usetypescript-plugin-styled-components
now.So added it, rebuild and published the library, but got the following warning without the CSS being applied when using the library in a third-party project.
A third-party minimal project where I use the library can be seen here. One can see in the console the warning and in the browser the non-styled HTML.
Let's get to the library which I upgraded to TS and which uses the
typescript-plugin-styled-components
package. The up-to-date implementation can be found here.I use it in my rollup.config.js which is the following:
I am not a 100% sure about this, but I think the rollup configuration still picks up my .babelrc file where I still use
babel-plugin-styled-components
if that matters:In addition, because I have found it in the documentation of this library, I added this library to my tsconfig.json too:
Essentially that's it. I hoped to get the CSS prop running again when I switched the library to TS, but whatever I do it doesn't work. Can anyone spot anything that's missing or wrongfully configured here? Very much appreciate any help that I can get here!
Not sure if related, but I also had to implement a styled.d.ts file in my library to please the type checking for the CSS prop:
The text was updated successfully, but these errors were encountered: