export let limit = 25;
export let limits = [10, 25, 50, 100, 200];
TypeScript infers the types as limit: number and limits: number[]. However, the Svelte 5 migration script generated a Props interface with limit?: number (expected) and limits?: any (unexpected). The any type prevents TypeScript from detecting type errors when a user of the component passes in an incorrect prop type (e.g. a string instead of an array of numbers).
Ideally the migration script would generate limits?: number[] in the Props interface to preserve the same type safety as in Svelte 4.
Describe the bug
My Svelte 4 component has the following props:
TypeScript infers the types as
limit: number
andlimits: number[]
. However, the Svelte 5 migration script generated aProps
interface withlimit?: number
(expected) andlimits?: any
(unexpected). Theany
type prevents TypeScript from detecting type errors when a user of the component passes in an incorrect prop type (e.g. a string instead of an array of numbers).Ideally the migration script would generate
limits?: number[]
in the Props interface to preserve the same type safety as in Svelte 4.Reproduction
https://github.com/theodorejb/trestable
src/lib/Pagination.svelte
is the component with the issue.Logs
No response
System Info
Severity
annoyance
Additional Information
No response