Skip to content

Astro is unable to properly handle Svelte 5 snippet props. #16217

@XhstormR

Description

@XhstormR

Astro Info

Astro                    v6.1.3
Node                     v25.8.2
System                   macOS (arm64)
Package Manager          bun
Output                   static
Adapter                  none
Integrations             @astrojs/svelte

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Issue: Astro cannot render svelte-sonner Toaster component directly due to Svelte 5 type incompatibility

When importing Toaster from svelte-sonner in an Astro file:

---
import { Toaster } from "svelte-sonner";
---
<Toaster />

Astro reports a type error: Type {} is not assignable because it's missing required properties (loadingIcon, successIcon, errorIcon, warningIcon, and 11 more).

These props are Svelte 5 snippets with default values — they're optional in Svelte but Astro's type checker treats them as required because it cannot properly interpret Svelte 5's snippet prop types.

sample: https://stackblitz.com/edit/github-jxscecjp-ddvyzwsh

Astro: Type { "client:only": string; } is not assignable to type
IntrinsicAttributes & StripNeverIndexSignatures<WidenChildrenIfSnippet<{
    invert?: boolean | undefined;
    position?: string | undefined;
    hotkey?: any[] | undefined;
    expand?: boolean | undefined;
    closeButton?: boolean | undefined;
    ... 26 more ...;
    onpointerup: any;
} & Record<...>>> & AstroComponentDirectives
Type { "client:only": string; } is missing the following properties from type
StripNeverIndexSignatures<WidenChildrenIfSnippet<{
    invert?: boolean | undefined;
    position?: string | undefined;
    hotkey?: any[] | undefined;
    expand?: boolean | undefined;
    closeButton?: boolean | undefined;
    offset?: "24px" | undefined;
    ... 25 more ...;
    onpointerup: any;
} & Record<...>>>
:
loadingIcon, successIcon, errorIcon, warningIcon
, and 11 more.
Image

What's the expected result?

Astro properly handle Svelte 5 snippet props without type error.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-jxscecjp-ddvyzwsh

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: svelteRelated to Svelte (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions