Skip to content

v4: svelte doesn't export ComponentType #8692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JReinhold opened this issue Jun 3, 2023 · 1 comment · Fixed by #8694
Closed

v4: svelte doesn't export ComponentType #8692

JReinhold opened this issue Jun 3, 2023 · 1 comment · Fixed by #8694

Comments

@JReinhold
Copy link

JReinhold commented Jun 3, 2023

Describe the bug

TypeScript is complaining that svelte doesn't export ComponentType, which looks to be true when I inspect the index.d.ts file from Svelte. However I don't see this mentioned in the migration notes, and #8512 even details that you should use ComponentType in v4 to type components.
Have I misunderstood something? I tried poking around in the version-4 branch, and couldn't find any ComponentType export either, but I admit that I could easily be missing it.

Script in Svelte v3 source adding the ComponentType export: https://github.com/sveltejs/svelte/blob/master/generate-type-definitions.js

Reproduction

https://github.com/JReinhold/svelte-8692-reproduction

This is a basic template created with npm create vite, installing svelte@next afterwards, and only modifying src/main.ts to reproduce the bug.

  1. npm install
  2. npm run check

See that importing ComponentType from "svelte/types/runtime/internal" is okay, but not directly from "svelte".

Logs

npm run check

> svelte-v4-repro@0.0.0 check
> svelte-check --tsconfig ./tsconfig.json


====================================
Loading svelte-check in workspace: /Users/jeppe/dev/temp/svelte-v4-repro
Getting Svelte diagnostics...

/Users/jeppe/dev/temp/svelte-v4-repro/src/main.ts:5:15
Error: Module '"svelte"' has no exported member 'ComponentType'.
import type { ComponentType as InternalComponentType } from "svelte/types/runtime/internal";
import type { ComponentType } from "svelte";



====================================
svelte-check found 1 error and 0 warnings in 1 file

System Info

System:
    OS: macOS 13.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 261.16 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
  Browsers:
    Chrome: 114.0.5735.90
    Safari: 16.2
  npmPackages:
    svelte: ^4.0.0-next.0 => 4.0.0-next.0

Severity

blocking an upgrade

@benmccann benmccann added this to the 4.x milestone Jun 3, 2023
@gtm-nayan gtm-nayan linked a pull request Jun 4, 2023 that will close this issue
5 tasks
@gtm-nayan
Copy link
Contributor

Fixed in 4.0.0-next.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants