kit
kit copied to clipboard
svelte-migrate svelte-5 - Type in `$state<HERE>` ?
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