Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda