Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

327
Views
Is there any better way to IntrinsicAttributes & TYPE in Typescript

This code is works good.

<AuctionCardGenerator auction={auction} />;
interface auctionType {
    auction: randomAuctionType;
}

const AuctionCardGenerator = ({ auction }: auctionType) => {
...
}

and randomAuctionType is looks this.

interface randomAuctionType {
    id: number;
    title: string;
    artist: {
        id: number;
        name: string;
        nickname: string;
    };
    type: string;
    price: string;
    description: string;
    status: AUCTION_STATE;
    nftToken?: string;
    imgSrc: string;
}

But I think that declaring auctionType just for this code isn't efficient. So I want to use just like bellow.

const AuctionCardGenerator = (auction: randomAuctionType) => {

But this code has error message like this enter image description here

So, Is there any simple way to avoid this problem in typescript?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you don't want to declare a standalone interface (although there's nothing wrong with it - it doesn't cost you anything!), you can use an inline type literal instead:

const AuctionCardGenerator = ({ auction }: { auction: randomAuctionType; }) => {
...
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!