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

325
Views
¿Hay alguna manera mejor de IntrinsicAttributes & TYPE en Typescript?

Este código funciona bien.

 <AuctionCardGenerator auction={auction} />;
 interface auctionType { auction: randomAuctionType; } const AuctionCardGenerator = ({ auction }: auctionType) => { ... }

y randomAuctionType se ve así.

 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; }

Pero creo que declarar el tipo de subasta solo para este código no es eficiente. Así que quiero usar como abajo.

 const AuctionCardGenerator = (auction: randomAuctionType) => {

Pero este código tiene un mensaje de error como este ingrese la descripción de la imagen aquí

Entonces, ¿hay alguna forma sencilla de evitar este problema en mecanografiado?

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

0

Si no desea declarar una interface independiente (aunque no tiene nada de malo, ¡no le cuesta nada!), puede usar un literal de tipo en línea en su lugar:

 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!