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
{{ message }}
Repository navigation
No longer works in composite typescript projects since 6.3.7 #5648
In a typescript project which uses composite: true the styled-components types now fail in the simplest case with:
TS2742: The inferred type of X cannot be named without a reference to ../node_modules/styled-components/dist/types. This is likely not portable. A type annotation is necessary.
This appears to be since the addition of the package exports field.
One solution appears to be to add export * from './types' rather than a restricted list here.
Reacted by Derek Cicerone, Vitor Amaral, Ian McCausland, Vít Rozsíval, Viktoryia Sihayeva, Romain Trotard, jasontlouro, Jonny Chen, Jeremy Marcus, Anton Khitrenovich and 5 more
so as i mentioned reverting to 6.3.5 fixed it locally for me (windows) but it kept failing to build in my hosting service Linux environment
been trying with different solutions last couple of days, and I hope this solution fixes it for all
changing tsconfig.json options of these 2 fields to
"moduleResolution": "node", // Changed from "bundler"
"esModuleInterop": true,
did the trick
hope it helps, I use it with react 18
Reacted by Jeremy Marcus, Vít Rozsíval and kyriiherman
Activity
imccausl commentedon Jan 16, 2026
FWIW, we are having the same issue, but do not use
composite: true. Reverting to 6.3.6 fixed it.justnewbee commentedon Jan 19, 2026
6.3.8 still breaks...
ALI-KHALED-13 commentedon Jan 20, 2026
for me reverting to 6.3.5 fixed it, newer versions break
ALI-KHALED-13 commentedon Jan 21, 2026
so as i mentioned reverting to 6.3.5 fixed it locally for me (windows) but it kept failing to build in my hosting service Linux environment
been trying with different solutions last couple of days, and I hope this solution fixes it for all
changing tsconfig.json options of these 2 fields to
did the trick
hope it helps, I use it with react 18
fix: add wildcard subpath export for dist to resolve TS2742 in compos…
quantizor commentedon Feb 8, 2026
Please try 6.3.9 https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9
ALI-KHALED-13 commentedon Feb 8, 2026
version 6.3.9 fixed it for me, thanks @quantizor