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

134
Views
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
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!