Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

323
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda