-
-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error for stroke-width attribute when using TypeScript #758
Comments
Hi!! I'm back with a simpler (and cleaner) way to avoid this linter error. export {};
declare module "@tabler/icons-vue" {
interface SVGProps {
strokeWidth?: number | string;
}
} So now I don't need to modify package files (yaaay 🎉). If creating a whole separated file feels "heavy", you can move it to any common.d.ts or global.d.ts or w/e file you use for type declarations (I usually use global.d.ts for declaring global window attached variables like window.axios or w/e so my typescript doesn't scream everytime I access those variables) (dunno if that's a good practice, I'm learning with baby steps). I found the solution following this post: Extending Global or Third Party Library Typing by malcolmkee Hope this helps! |
Resolved by PR #763 |
I'm using the
@tablericons/vue
package but keep getting an error when using typescript:Basic example:
This returns the error (see screenshot below):
I have also tried using it is a number via
<IconSearch ... :stroke-width="1" />
In
tabler-icons-vue.d.ts
it says:When I add
strokeWidth?: 2 | number
to it and reload my VSC window, it actually works.The docs makes it more confusing/inconsistent by saying we should use
stroke-with="1.25"
but the prop is juststroke
(number)?What is the best way to go about this?
Attachment
The text was updated successfully, but these errors were encountered: