-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
Icon type
no longer exported.
#1761
Comments
Hey, @ericfennis, @AdrianGonz97 Sorry, but the issue that now arises is similar to the one from an earlier discussion; #1585 (reply in thread)
|
Ah, this raises an interesting point, @shyakadavis. The current solution for you would be to do what @lolcabanon suggested in the thread #1585 (reply in thread), to use import type { ComponentType } from 'svelte';
import type { Icon } from 'lucide-svelte';
type TRoute = {
name: string;
path: string;
icon: ComponentType<Icon>;
}; Now, is this solution ideal? Should the For example: import type { Icon } from 'lucide-svelte';
type TRoute = {
name: string;
path: string;
icon: Icon;
}; The advantage of this is convenience. But we do miss out on the opportunity on using the import { Accessibility, Bean, type Icon } from "lucide-svelte";
import type { ComponentProps, ComponentType } from "svelte";
type TRoute = {
name: string;
path: string;
icon: ComponentType<Icon>;
props: ComponentProps<Icon>;
};
const routes: TRoute[] = [
{
name: "foo",
path: "/foo",
icon: Accessibility,
props: {
size: 10
}
},
{
name: "bar",
path: "/bar",
icon: Bean,
props: {
size: 20,
}
},
]; However, this may not be very intuitive, so I'm not quite sure what I'd prefer. @ericfennis was this what you had in mind when you originally exported the |
@AdrianGonz97 IMO it's ok as-is since the It's a bit like doing Maybe a note with example in I'd be willing to do a PR for it if you'd like. Just tell me! |
Ah, I see. I don't think I have a great personal opinion about this, but it seems leaving stuff explicit is better. That said, I opened a P.R; @AdrianGonz97, @lolcabanon please have a look and let me know if you think there's something to add/remove. |
Package
Version
0.302.0
Description
If I try to import the type of an icon for using in a TS env, I get the error:
Steps to reproduce
Checklist
The text was updated successfully, but these errors were encountered: