You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script lang="ts">
import { textfit } from 'svelte-textfit';
let parent;
</script>
<a bind:this={parent} href="#">
<p use:textfit={{parent, mode:"single"}}><slot /></p>
</a>
And it resulted in the following error:
Argument of type '{ parent: any; mode: "single"; }' is not assignable to parameter of type 'TextfitProps'.
Type '{ parent: any; mode: "single"; }' is missing the following properties from type 'TextfitProps': update, min, max, forceSingleModeWidth, and 8 more.ts(2345)
I also tried coercing type like <TextfitProps>{parent, mode:"single"} and ({parent, mode:"single"} as TextfitProps) but it doesn't seem like Svelte liked or understood it.
Any ideas?
The text was updated successfully, but these errors were encountered:
That appears to be a Typescript error. Maybe it does not like the parent to be 'any'. Could you try to define the type in the script section? Like:
letparent : Node|undefined
Casting types outside of the script tag is not supported by Svelte at the moment afaik.
It is also complaining about missing properties, but since they are all optional it the complaint doesn't make a lot of sense to me. Which version of textfit so you have installed?
@micha-lmxt related to your response about the version installed: the most recent update that has all props being optional isn't accessible via npm install for some reason. npm install svelte-textfit@latest returns v.1.1.1, and trying to install 1.1.2 fails. Thanks for looking into this!
I tried using the library like this:
And it resulted in the following error:
I also tried coercing type like
<TextfitProps>{parent, mode:"single"}
and({parent, mode:"single"} as TextfitProps)
but it doesn't seem like Svelte liked or understood it.Any ideas?
The text was updated successfully, but these errors were encountered: