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

166
Vistas
Fixing Type incompatibility issues (TypeScript React)

I am receiving this build error:

Type '{ executionTime: number; schema: { \[k: string\]: { name: string; index: number; type: string; }; }; values: Document\[\]\[\]; }' is not assignable to type 'DataGridData'.
Types of property 'schema' are incompatible.
Type '{ \[k: string\]: { name: string; index: number; type: string; }; }' is not assignable to type 'Schema'.
'string' index signatures are incompatible.
Type '{ name: string; index: number; type: string; }' is not assignable to type '{ name: string; index: number; type: SchemaDataType; }'.
Types of property 'type' are incompatible.
Type 'string' is not assignable to type 'SchemaDataType'.

It boils down to type 'string' not being compatible with explicitly defined type SchemaDataType. Here is that defined type:

export type SchemaDataType =
| 'DateTime'
| 'Decimal'
| 'Guid'
| 'Int32'
| 'String';

'string' is not being recognized as 'String'.

function mapKeys() {
  const docKeys = Object.keys(items);
  const result = Object.fromEntries(
    docKeys.map((el, index) => {
      return [el, { name: el, index, type: el.constructor.name }];
    }),
  );
  return result;
}

This function I created transforms the json response in the DB to a palitable structure for a custom DataGrid that I am trying to implement. I attemted a fix by capitalizing the first letter of 'type' like so but this did not fix the issue:

function mapKeys() {
  const docKeys = Object.keys(items);
  const result = Object.fromEntries(
    docKeys.map((el, index) => {
      return [
        el,
        {
          name: el,
          index,
          type:
            el.constructor.name.charAt(0).toUpperCase() +
            el.constructor.name.slice(1),
        },
      ];
    }),
  );
  return result;
}
about 4 years ago · Juan Pablo Isaza
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