Skip to content

svelte-check ​

The svelte-check checker runs svelte-check, which reports type errors, Svelte compiler warnings, and accessibility warnings in Svelte components and .ts files.

Set up ​

  1. Install svelte-check (version 4 or later) and TypeScript:

    bash
    pnpm add -D svelte-check typescript
    bash
    npm install -D svelte-check typescript
    bash
    yarn add -D svelte-check typescript
    bash
    bun add -d svelte-check typescript
  2. Enable the checker:

    ts
    checker({
      svelteCheck: true,
    })

In dev mode, the checker runs svelte-check --watch from the Vite root. In build mode, it runs svelte-check.

Pass flags to svelte-check ​

Use flags to pass svelte-check CLI flags, for example to choose a tsconfig:

ts
checker({
  svelteCheck: {
    flags: '--tsconfig ./tsconfig.app.json',
  },
})

In dev mode, the checker manages --watch, --preserveWatchOutput, and --output itself, so those flags only apply in build mode. --workspace applies in both modes and defaults to the Vite root.

Options ​

OptionTypeDefaultDescription
flagsstring''CLI flags for svelte-check.
dev.logLevel('error' | 'warning')[]['error', 'warning']Diagnostic levels to report in dev mode.

Released under the MIT License.