Skip to content

What is the type of a lucide-svelte icon? #1585

Answered by lolcabanon
shyakadavis asked this question in Q&A
Discussion options

You must be logged in to vote

@shyakadavis if I got that right you should be able to do this then (when the type will be exported again in a fix release?) :

import { type ComponentType } from 'svelte';
import { type Icon } from 'lucide-svelte'; 

type TRoute = {
	name: string;
	path: string;
	icon: ComponentType<Icon>;
};

Your issue was probably with how svelte handle component prop types, you have to wrap it in a ComponentType<>.

I'll just let @ericfennis confirm that the Icon type should still be exported.

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@shyakadavis
Comment options

Comment options

You must be logged in to vote
8 replies
@shyakadavis
Comment options

@ericfennis
Comment options

@lolcabanon
Comment options

@lolcabanon
Comment options

Answer selected by shyakadavis
@shyakadavis
Comment options

@AdrianGonz97
Comment options

@shyakadavis
Comment options

@GusMartins499
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants