Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

447
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda