Skip to content
Discussion options

You must be logged in to vote

I think @skdishansachin means in typescript, if we have an object with "icon" key, what type of return we have to add? I also need this

Edit:

Ok I found the solution:

import { LucideIcon } from "lucide-react";

export type TestInterface = {
  title: string;
  icon: LucideIcon;
};

And when you use your TestInterface, you have to use like this:

import { ArrowBigUp } from "lucide-react";

const test: TestInterface = {
  title: "Test title",
  icon: ArrowBigUp // be careful, don't use as a component like <ArrowBigUp />
}

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@ThalyssonLeite
Comment options

@tolgamorf
Comment options

@Robots-Pixels
Comment options

Answer selected by skdishansachin
Comment options

You must be logged in to vote
0 replies
Comment options

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

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
9 participants