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

515
Visualizações
Type is not assignable to type IntrinsicAttributes

I have create a function like this:

type MainProps = { sticky: boolean, refStickyElement: any };
export const MainBlog = ({ sticky, refStickyElement }: MainProps,mposts: TPost[]) => {
...

but when I want to use this function at another function I got error:

  const {results} = data
  let posts: Array<TPost> = results;
 <MainBlog refStickyElement={element} sticky={isSticky} posts={posts} />

error is for posts={posts}:

Type '{ refStickyElement: MutableRefObject<null>; sticky: boolean; posts: TPost[]; }' is not assignable to type 'IntrinsicAttributes & MainProps'.
  Property 'posts' does not exist on type 'IntrinsicAttributes & MainProps'.
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you want to pass posts as a prop, you have to add it to the MainProps type. React function components only have one param, which is an object (the props).
Therefore, you would have change your MainProps type to:

type MainProps = { sticky: boolean, refStickyElement: any, posts: TPost[] };

export const MainBlog = ({ sticky, refStickyElement, posts }: MainProps) => {
  //  ...
}
about 4 years ago · Juan Pablo Isaza Relatório
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