V
V
vacoo2018-10-07 14:24:35
typescript
vacoo, 2018-10-07 14:24:35

Why can't react native with typescript compile because of ENUM?

When compiling, it gives the following error:

error: bundling failed: SyntaxError: /home/vacoo/www/vodopad/app_client/src/resources/core/index.tsx: enum is a reserved word (4:0)

  2 | import Helpers from "./helpers";
  3 |
> 4 | export enum NetworkRequestStatus {
    |        ^
  5 |     REQUEST = "request",
  6 |     SUCCESS = "success",
  7 |     FAILED = "failed"

Add @babel/plugin-proposal-export-default-from (https://git.io/vb4yH) to the 'plugins' section of your Babel config to enable transformation.
    at _class.raise (/home/vacoo/www/vodopad/app_client/node_modules/@babel/parser/lib/index.js:3939:15)

my package.json is https://pastebin.com/FL4P2DD4

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vacoo, 2018-10-13
@vacoo

The problem was in .babelrc
Should be put instead of
this

"presets": ["module:metro-react-native-babel-preset"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question