Closed kinchad closed 1 month ago
This is Typescript message, caused by the fact that you have not set a type for placement
and it defaults to string
.
Add this:
<script>
/** @type {import('@floating-ui/dom').Placement} */
let placement = 'left';
</script>
or use ts
mode:
<script lang="ts">
import type { Placement } from '@floating-ui/dom';
let placement:Placement = 'left';
</script>
This is Typescript message, caused by the fact that you have not set a type for
placement
and it defaults tostring
. Add this:<script> /** @type {import('@floating-ui/dom').Placement} */ let placement = 'left'; </script>
or use
ts
mode:<script lang="ts"> import type { Placement } from '@floating-ui/dom'; let placement:Placement = 'left'; </script>
Thanks for your reply, but it is not working
I do not have the module @floating-ui/dom
, so i install with pnpm i @floating-ui/dom
Then I can use your provided code without error in my editor. But there is an error at the broswer console
If i use non-ts mode, i got this error:
if i use ts mode, i got this error:
I tried to re-create a new Sveltekit project and test the code, it's working. so i guess i have some mis-config or contradiction in my code. I will try to figure out the problem, Anyway thanks for your help.
Since it is listed in the dependencies,
it automatically installed under .pnpm
dir.
"dependencies": {
"@floating-ui/dom": "^1.6.3",
"apexcharts": "^3.48.0",
"flowbite": "^2.3.0",
"tailwind-merge": "^2.2.2"
},
Describe the bug
I copy and paste the sample code
But it does not work with the error at the
{placement}
which says Type String is not assignable to type 'Placement | undefined'. Am i missing something?Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-r3e99a?file=README.md,src%2Froutes%2F%2Bpage.svelte
Flowbite version and System Info