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

445
Visualizações
React Typescript: Antd Table filter

I am getting an error in the columns when I try the following:

{
   title: "Gruppe",
   dataIndex: 'group',
   filters: [
      this.state.dropdownItems.map((item) => ({
         text: item.group,
         value: item.group
      })
   )],
   onFilter: (value, record) => record.TransactionType.includes(value),
},

Error: *TS2322 (TS) Type '({ title: string; dataIndex: string; key: string; width: number; align: "center"; sorter: (a: any, b: any) => number; filters?: undefined; onFilter?: undefined; render?: undefined; } | { title: string; ... 7 more ...; render?: undefined; } | { ...; } | { ...; } | { ...; })[]' is not assignable to type 'ColumnsType'. Type '{ title: string; dataIndex: string; key: string; width: number; align: "center"; sorter: (a: any, b: any) => number; filters?: undefined; onFilter?: undefined; render?: undefined; } | { title: string; ... 7 more ...; render?: undefined; } | { ...; } | { ...; } | { ...; }' is not assignable to type 'ColumnGroupType | ColumnType'. Type '{ title: string; dataIndex: string; width: number; align: "center"; filters: { text: string; value: string; }[][]; onFilter: (value: any, record: any) => any; key?: undefined; sorter?: undefined; render?: undefined; }' is not assignable to type 'ColumnGroupType | ColumnType'. Type '{ title: string; dataIndex: string; width: number; align: "center"; filters: { text: string; value: string; }[][]; onFilter: (value: any, record: any) => any; key?: undefined; sorter?: undefined; render?: undefined; }' is not assignable to type 'ColumnType'. Types of property 'filters' are incompatible. Type '{ text: string; value: string; }[][]' is not assignable to type 'ColumnFilterItem[]'. Type '{ text: string; value: string; }[]' is missing the following properties from type 'ColumnFilterItem': text, value *

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

0

Since map returns a new array, so now you are defining an 2 dimensional array as filters, it should be like this:

filters: [
  ...this.state.dropdownItems.map((item) => ({
     text: item.group,
     value: item.group
  })
)]

Or:

filters: this.state.dropdownItems.map((item) => ({
     text: item.group,
     value: item.group
  })
)
about 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