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

162
Views
¿Cómo escribir un componente con estilo para que pueda pasar {... resto} como accesorio sin que la sobrecarga coincida con este error de TypeScript de llamada?

Tengo un componente que devuelve un componente con estilo al que pasa una variante de accesorio. También quiero difundir el resto de los accesorios usando {...rest} , sin embargo, tan pronto como lo hago, aparece un error de mecanografiado porque mi componente con estilo no espera ningún otro accesorio. ¿Cómo se supone que debo indicar que el componente con estilo puede esperar accesorios extendidos?

 type HeaderVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; type Props = { variant?: HeaderVariant; style?: StyleProp<ViewStyle>; } & TextProps; interface StyledBaseButtonProps { variant: HeaderVariant; } const HeaderText: FunctionComponent<Props> = ({ variant = 'h1', children, ...rest }) => { return ( <StyledText variant={variant} {...rest}> {children} </StyledText> ); }; const StyledText = styled.Text<StyledBaseButtonProps>` font-family: ${(props) => styles[props.variant].fontFamily}; color: ${(props) => styles[props.variant].color}; font-weight: ${(props) => styles[props.variant].fontWeight}; font-size: ${(props) => styles[props.variant].fontSize}; line-height: ${(props) => styles[props.variant].lineHeight}; `;
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!