I'm using Svelte (Vite) + Bootstrap 5 + SvelteStrap. My code is the following:
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css">
</head>
<script>
import { Button } from 'sveltestrap';
let color = "danger";
</script>
<div>
<Button color="{color}">{color}</Button>
</div>
This works normally on the browser, but VSCode says:
Type 'string' is not assignable to type 'ButtonColor'.
I'm just starting out with Svelte, and I'm trying to modify the standard example on the SvelteStrap website:
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css">
</head>
<script lang="ts">
import { Button } from 'sveltestrap';
const colors: any = [
'primary',
'secondary',
'success',
'danger',
'warning',
'info',
'light',
'dark'
];
</script>
{#each colors as color}
<div>
<Button {color}>{color}</Button>
</div>
{/each}
Using the standard example, no erros are fired. What am I doing wrong? Why is this happening?