Skip to content

[v3] SvelteKit should have an optionalPeerDependency on typescript #13750

@lishaduck

Description

@lishaduck

Describe the bug

I'm using pnpm with hoist: false, so @sveltejs/kit can't import typescript on this line:

ts = (await import('typescript')).default;

Reproduction

Happy to provide one, but I think this is self-explanatory?

Logs

====================================
Loading svelte-check in workspace: /Users/dukese01/Developer/psdtools.github.io/apps/petal-notes
Getting Svelte diagnostics...

/Users/dukese01/Developer/psdtools.github.io/apps/petal-notes/src/routes/(wrapper)/+layout.ts:1:33
Error: Cannot find module './$types' or its corresponding type declarations. 
import type { LayoutLoad } from "./$types";
import type { Folder } from "./treeview.ts";


/Users/dukese01/Developer/psdtools.github.io/apps/petal-notes/src/routes/(wrapper)/notes/[...path]/+page.ts:3:31
Error: Cannot find module './$types' or its corresponding type declarations. 

import type { PageLoad } from "./$types";



/Users/dukese01/Developer/psdtools.github.io/apps/petal-notes/src/routes/(wrapper)/notes/[...path]/+page.ts:16:34
Error: Binding element 'params' implicitly has an 'any' type. 

export const load: PageLoad = ({ params }): Data => {
  const note = notes.get(params.path.slice(0, -1));


====================================
svelte-check found 3 errors and 0 warnings in 2 files

System Info

System:
    OS: macOS 15.4.1
    CPU: (8) arm64 Apple M1
    Memory: 153.38 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.10.0 - ~/.local/share/mise/installs/node/23.10.0/bin/node
    npm: 10.9.2 - ~/.local/share/mise/installs/node/23.10.0/bin/npm
    pnpm: 10.10.0 - ~/.local/share/mise/installs/node/23.10.0/bin/pnpm
    Watchman: 2025.04.14.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 135.0.7049.115
    Safari: 18.4
  npmPackages:
    @sveltejs/adapter-static: catalog: => 3.0.8 
    @sveltejs/kit: catalog: => 2.20.1 
    @sveltejs/vite-plugin-svelte: catalog: => 5.0.3 
    svelte: catalog: => 5.23.2 
    vite: catalog: => 6.2.2

Severity

annoyance

Additional Information

No response

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