kit icon indicating copy to clipboard operation
kit copied to clipboard

svelte-migrate svelte-5 - Type in `$state<HERE>` ?

Open jycouet opened this issue 1 year ago • 13 comments

Describe the problem

Today when I tried migrate, I had:

type TileStatus = "Success" | "Error" | "Warning" | "Info" | "Loading";

// svelte 4
let status: TileStatus = "Loading";
// after migrate:
let status: TileStatus = $state("Loading");

But then, I have some type error:

This comparison appears to be unintentional because the types '"Loading"' and '"Error"' have no overlap.

Describe the proposed solution

type TileStatus = "Success" | "Error" | "Warning" | "Info" | "Loading";

// svelte 4
let status: TileStatus = "Loading";
// after migrate:
let status = $state<TileStatus>("Loading");

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

jycouet avatar Oct 18 '24 09:10 jycouet