Skip to content

No longer works in composite typescript projects since 6.3.7 #5648

Closed

Description

@domarmstrong

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.

See very simple reproduction here.

Activity

  1. imccausl commented on Jan 16, 2026

    @imccausl

    FWIW, we are having the same issue, but do not use composite: true. Reverting to 6.3.6 fixed it.

  2. justnewbee commented on Jan 19, 2026

    @justnewbee

    6.3.8 still breaks...

  3. ALI-KHALED-13 commented on Jan 20, 2026

    @ALI-KHALED-13

    for me reverting to 6.3.5 fixed it, newer versions break

  4. ALI-KHALED-13 commented on Jan 21, 2026

    @ALI-KHALED-13

    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

  5. added a commit that references this issue on Feb 7, 2026
    015da56
  6. quantizor commented on Feb 8, 2026

    @quantizor
    Contributor
  7. ALI-KHALED-13 commented on Feb 8, 2026

    @ALI-KHALED-13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions