sveltejs/svelte

Regression (Svelte 5.39.8): Type instantiation is excessively deep and possibly infinite.

Opened this issue · 1 comments

Describe the bug

When using svelteflow's Node type with Svelte's $state.Snapshot type, upgrading to svelte 5.39.8 leads to hitting the recursion limit in type-checking.

This sounds to me like a consequence of #16864.

Reproduction

<script lang="ts">
	import { type Node } from "@xyflow/svelte";
	const _ = {} as Node as $state.Snapshot<Node>;
</script>

Logs

System Info

System:
    OS: Linux 6.17 Arch Linux
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H
    Memory: 5.99 GB / 15.35 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 25.1.0 - /usr/bin/node
    npm: 11.6.2 - /usr/bin/npm
  Browsers:
    Chromium: 142.0.7444.59
    Firefox: 144.0.2
    Firefox Developer Edition: 144.0.2

Severity

blocking an upgrade

Minimized:

type Container = {
    class: Recursive;
};
type Recursive = Recursive[];
const _ = {} as Container as $state.Snapshot<Container>;

The concrete type of Recursive in the original snippet is clsx's ClassArray type, which is part of Svelte's ClassValue type.