You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current components use the old generic implementation, which requires explicit declaration of generic types in a module script prior to their usage in the component. As an example, in form-field.svelte:
<script lang="ts" module>
import type { FormPath as _FormPath } from "sveltekit-superforms";
type T = Record<string, unknown>;
type U = _FormPath<T>;
</script>
<script lang="ts" generics="T extends Record<string, unknown>, U extends _FormPath<T>">
import * as FormPrimitive from "formsnap";
...
As of svelte 5, the entire module block is no longer required for generics to function, and Typescript currently errors with
Error: 'U' is declared but never used. (ts)
type T = Record<string, unknown>;
type U = _FormPath<T>;
</script>
Based on the current documentation: https://svelte.dev/docs/svelte/typescript#Generic-$props - it appears that the module script is no longer necessary? Or at least, having the previously required module block is no longer mentioned anywhere in the documentation.
For the shadcn components I tested, if you delete the module block entirely, everything works as expected. There are no errors about missing types when the module block is removed.
Describe the bug
The current components use the old generic implementation, which requires explicit declaration of generic types in a module script prior to their usage in the component. As an example, in
form-field.svelte
:As of svelte 5, the entire module block is no longer required for generics to function, and Typescript currently errors with
Svelte generics docs: https://svelte.dev/docs/svelte/typescript#Generic-$props
Reproduction
no reproduction - compiler error is in shadcn source
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: