-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
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.
npm install
npm run check
See that importing ComponentType
from "svelte/types/runtime/internal"
is okay, but not directly from "svelte"
.
Logs
npm run check
> [email protected] 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