使用此代码和eslint-plugin-svelte3:
<script lang="ts">
import { writable } from "svelte/store";
type Player = {
name: string;
};
const playersStore = writable([] as Player[]);
$: players = $playersStore;
</script>
{players}
我得到这个打字稿错误:
Unsafe assignment of an any value.eslint@typescript-eslint/no-unsafe-assignment
在线的:
$: players = $playersStore;
为什么?
如果我使用,错误就会消失:
$: players = playersStore;
但我认为这不是一个解决方案:是一个错误,对吧?