Skip to content

[bug] private ComponentType interface breaks type declarations #14256

@Theo-Steiner

Description

@Theo-Steiner

Describe the bug

When using tsc to emit types for a svelte 5 project with "declarations": true set in the tsconfig.json, the compilation fails with an error: error TS4082: Default export of the module has or is using private name 'ComponentType'.

(Interestingly, the problem only seems to occur, when a component is passed "through" a generic function, in case of the reproduction: doSth)

Reproduction

https://stackblitz.com/edit/vitejs-vite-fgmgkx?file=src%2Findex.ts

run npx tsc to see how the compilation fails.

Potential fix:
if we go to node_modules/svelte/types/index.d.ts line 2315 however, and modify it to export the interface, the compilation finishes without error.

Logs

No response

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 88.94 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.12.0 - ~/Library/Caches/fnm_multishells/75820_1731292463955/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 8.19.2 - ~/Library/Caches/fnm_multishells/75820_1731292463955/bin/npm
  Browsers:
    Chrome: 106.0.5249.91
    Safari: 17.5
  npmPackages:
    svelte: ^5.1.9 => 5.1.12

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions