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

359
Visualizações
Argument of type '{ identifier: string; }' is not assignable to parameter of type 'ConcatArray<never>'

I'm new on typescript, here i have been adding typescript to my project, getting this strange error: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error. Argument of type '{ identifier: string; }' is not assignable to parameter of type 'ConcatArray<never>'. Type '{ identifier: string; }' is missing the following properties from type 'ConcatArray<never>': length, join, slice Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error. Argument of type '{ identifier: string; }' is not assignable to parameter of type 'ConcatArray<never>'.ts(2769)

my code where it is giving me that(reducers.ts):

interface Update_AnalyserState {
  identifier: string;
}

const initialArticleState= {
  analysers: [],
};
export function articleReducer(
  state = initialArticleState,
  action: articleReducerAction
) {
  switch (action.type) {
   
    case ActionType.UPDATE_ANALYSER:
      return {
        ...state,
        analysers: state.analysers
          .filter(
            (a: Update_AnalyserState) =>
              a.identifier != action.payload.identifier
          )
          .concat(action.payload),
      };
       }
}

any help/suggestion with this ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It's not easy to debug from your example but I think the problem is this

const initialSiteArticleState = {
  analysers: [],
};

Your analyzers is an empty array type so it means it's never[]. So the result of the filter is going to be a never[]. So you will have to correctly type that initialSiteArticleState.

Something like

const initialSiteArticleState:{analysers: Update_AnalyserState[]} = {
  analysers: [],
};

Give it a shot. Here is also a playground that I tried to reproduce your code. If you hover on tmp you can see it's type never[].

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