I'm struggling with typing Svelte 3 reactive syntax variables.
<script lang="ts">
import type { Player, Team } from "./types";
import { DEFAULT_PLAYER } from "./utils";
$: player = DEFAULT_PLAYER as Player;
$: team = { search: "Real", players: [] } as Team;
</script>
Unfortunately, I encountered an error:
'Team' cannot be used as a value because it was imported using 'import type'.ts(1361)
After trying a different approach:
$: team = ({ search: "Real", players: [] } as Team);
The VSCode extension svelte.svelte-vscode
reverts it back to the original format when I save.
Is this a mistake on my end?
Is there a more effective way to cast these reactive variables?