svench
svench copied to clipboard
How to use Typescript in .svench file?
I'm wanting to use Types in my Svench file to set up the view but Vite will throw errors as soon as I start using typings like this:
<script lang="ts">
import { View } from 'svench';
import type { ICharacterArray } from '$lib/interfaces/character.interface';
import { writable } from 'svelte/store';
let characters = writable<ICharacterArray>({
curious: [''],
todo: [''],
pronunciation: ['', ''],
tone: [''],
known: ['你', '好'],
});
import { setContext } from 'svelte';
setContext('characters', characters);
import Characters from './Characters.svelte';
</script>
<View>
<Characters text="你" />
</View>