Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!