3

I'm using create-react-app template with typescript. On my local pc, run build successfully, but when run in CI server, build failed.

  • build error

./src/store/redux/info/index.ts Syntax error: Cannot read property 'name' of undefined (0:undefined)

But there is no 'name' property in file

info/index.ts

export { default } from "./reducer";
export * from "./actions";
export * from "./types";
 "react": "16.12.0",
 "react-app-rewired": "2.1.5",
 "antd": "3.26.5",
 "antd-theme-webpack-plugin": "1.3.0",
 "typescript": "3.7.4",
    "build": "react-app-rewired --max-old-space-size=8192 build",
ROOT
  • 11,363
  • 5
  • 30
  • 45
Jiwoo Hong
  • 33
  • 1
  • 3
  • Does this answer your question? [React Typescript: Line 0: Parsing error: Cannot read property 'name' of undefined](https://stackoverflow.com/questions/60729199/react-typescript-line-0-parsing-error-cannot-read-property-name-of-undefine) – Gricey Mar 23 '20 at 04:11

2 Answers2

6

It seems to be an issue with 'typescript-eslint'.

It could be resolved by updating Typescript version to 3.8.x - as pointed out by user Phoebus at an other question: https://stackoverflow.com/a/60734819/5758225

Github issue (and PR link in comments): https://github.com/typescript-eslint/typescript-eslint/issues/1746

Dániel Szabó
  • 374
  • 2
  • 5
2

Update your typescript version to @latest. 3.8.3 as of today.

Once you do that, quit your IDE and restart. I had the same issue and thought that upgrading wasn't working. Then I read in the Github issue that you need to restart the IDE. Everything worked after that fine

  • Thank you sir! I was reading the same issue, but couldn't get things to work until your comment pointed me to upgrading Typescript itself rather than the eslint package. – George Apr 28 '20 at 02:54