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

138
Vistas
Dynamically assign an attribute to HTML in typescript

I have just installed Typescript and am trying to deploy it to an existing project. I am trying to dynamically assign a "name" attribute to a div component (Header.Arrow) created with styled components, unfortunately this is not possible due to an errors that occurs:

Type '{ role: "button"; name: string; "aria-label": string; }' is not assignable to type 'IntrinsicAttributes......

Property 'name' does not exist on type 'IntrinsicAttributes & .......


import { Container, Arrow, Frame, Logo } from './styles/header';

const Header = ({ children, ...restProps }: {children: React.ReactNode}): JSX.Element => {
  return <Container {...restProps}>{children}</Container>;
};

Header.Arrow = function HeaderArrow({ action, ...restProps }: {action: string}) : JSX.Element {
  return (
    <Arrow
      role="button"
      name={action === 'previous' ? 'previous' : 'next'}
      aria-label={action === 'previous' ? 'previous' : 'next'}
      {...restProps}
    />
  );
}; 

What could be the cause? "aria-label" and "role" attributes does not cause the errors

about 4 years ago · Juan Pablo Isaza
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