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

286
Vistas
Property 'id' does not exist on type 'never'. typescript

i've trying to show image from JSON api and then show it to page, i was do it succesfully but for some reason when i go to page i've get this errors

Property 'id' does not exist on type 'never'.
Property 'url' does not exist on type 'never'.
Property 'title' does not exist on type 'never'.

here is the code

 const App = () => {
 const [images, setImages] = useState([]);
 useEffect(() => {
 fetch('https://api.thecatapi.com/v1/images/search?breed_id=abys')
  .then(res => res.json())
  .then(json => setImages(json))
  .catch(err => console.log(err));
}
, []);
return (
<Fragment>
  <div className="App">
    <h1>Image Gallery</h1>
    <div className="image-container">
      {images.map(image => (
        <Image key={image.id} image={image.url} alt={image.title} />
      ))}
    </div>
  </div>
</Fragment>
);
}
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You havent declared a type for image in your useState

const [images, setImages] = useState([]);

so it is considered as type never.

What you should do is add an interface eg IImage and then declare it in your useState

export default interface IImage {
  id: number
  url: string
  title: string
}

const [images, setImages] = useState<IImage[]>([]);
about 4 years ago · Santiago Gelvez 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