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

184
Visualizações
ts(2322) Property children does not exist on type 'Intrinsic attributes and Props'

I'm getting the following error while trying to create a multimap with 'date' as the key and then iterate through the multimap which has arrays as it's values.

Type '{children: never[]; key: string; Index: string; Item: SomeItem[]; }' is not assignable to type 'IntrinsicAttributes & Props'. Property 'children' does not exist on type 'IntrinsicAttributes & Props'. ts(2322)

and not sure how to fix this


   const History = () => {
   
  
   const [counter, setCounter] = useState(0);
   type SomeMap = Map<string,  SomeItem[]>;
   let map: SomeMap = new Map();

    //Items is of type SomeItem[]
    Items.foreach((item) =>{
      if(map.has(item.date)){
       (map.get(item.date) ?? []).push(item);
       } 
      else{
       map.set(item.date,[item]);
       }
      });

      return(
        <Accordian>
         { map.foreach((value, index) => {
           setCounter(counter +1 );
           <Task
            key={index}
            Index={counter.toString()}
            Item={value}>
           </Task>
         })}
        </Accordian>
     );
   
    };

    
   
    type Props = {
     index: string;
     Item: SomeItem[];
    };

    const Task = (props:Props) => {

     const index = props.Index;
     const Item = props.SomeItem;

     
     render(/*Some Code*/);
    };


over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Task is not typed to receive children, but actually you are actually passing a newline text node as the task's children.

      <Task
        key={index}
        Index={counter.toString()}
        Item={value}>{/* there is a new line text node here */}
      </Task>

You probably want to make the JSX tag self closing to ensure it has no children:

      <Task
        key={index}
        Index={counter.toString()}
        Item={value}
      />

Playground

over 4 years ago · Santiago Trujillo 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