React-admin: Typescript error in ra-core

Created on 12 Sep 2020  路  2Comments  路  Source: marmelab/react-admin

I'm following the tutorial at https://marmelab.com/react-admin/Tutorial.html and have hit an error. My project is using Typescript.

TypeScript error in /home/foo/bar/node_modules/ra-core/esm/controller/field/index.d.ts(10,1):
Declaration or statement expected.  TS1128

     8 | export declare type ReferenceArrayProps = ListControllerProps;
     9 | export declare type ReferenceManyProps = ListControllerProps;
  > 10 | export type { LinkToType };
       | ^
    11 | export { useReferenceArrayFieldController, ReferenceArrayFieldController, ReferenceFieldController, getResourceLinkPath, useReferenceManyFieldController, ReferenceManyFieldController, };
    12 |

I have tried the solutions mentioned here but I still have the error.

My dependencies are:

 "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "@types/jest": "^24.9.1",
    "@types/node": "^12.12.58",
    "@types/react": "^16.9.49",
    "@types/react-dom": "^16.9.8",
    "prop-types": "^15.7.2",
    "ra-data-json-server": "^3.8.4",
    "react": "^16.13.1",
    "react-admin": "^3.8.4",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.3",
    "typescript": "^3.7.5"

Most helpful comment

I have faced this issue today too. I done 2 things:

  1. Update TS to 4.0:
yarn add [email protected] 
  1. Ignore ts warning in { Admin }:
// @ts-ignore
import { Admin, Resource } from 'react-admin';

All 2 comments

I have faced this issue today too. I done 2 things:

  1. Update TS to 4.0:
yarn add [email protected] 
  1. Ignore ts warning in { Admin }:
// @ts-ignore
import { Admin, Resource } from 'react-admin';

Thanks for the pointer. Upgrading to Typescript 4.0 fixed the compilation error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kikill95 picture kikill95  路  3Comments

mbj36 picture mbj36  路  3Comments

nicgirault picture nicgirault  路  3Comments

pixelscripter picture pixelscripter  路  3Comments

aserrallerios picture aserrallerios  路  3Comments