question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken in react-native@0.57.0-rc.3

See original GitHub issue

I’m aware that I’m a bit early here but I just wanted to let you know or ask if the transformer might be broken in the newest version of react-native ?

SyntaxError: /testproject/src/components/Test.tsx: Unexpected token, expected ")" (37:30)

  35 | 
  36 | interface SectionProps {
> 37 |     content: (({ i, isActive }: { i: number, isActive: boolean }) => React.ReactElement<any>) | string;
     |                               ^
  38 |     label: string;
  39 |     info: string | number;
  40 |     direction?: 'row' | 'column';

SyntaxError: /testproject/src/components/Test.tsx: Unexpected token, expected ")" (37:30)

  35 | 
  36 | interface SectionProps {
> 37 |     content: (({ i, isActive }: { i: number, isActive: boolean }) => React.ReactElement<any>) | string;
     |                               ^
  38 |     label: string;
  39 |     info: string | number;
  40 |     direction?: 'row' | 'column';
    at _class.raise (/testproject/node_modules/@babel/parser/lib/index.js:3906:15)
    at _class.unexpected (/testproject/node_modules/@babel/parser/lib/index.js:5235:16)
    at _class.expect (/testproject/node_modules/@babel/parser/lib/index.js:5223:28)
    at _class.tsParseParenthesizedType (/testproject/node_modules/@babel/parser/lib/index.js:8943:12)
    at _class.tsParseNonArrayType (/testproject/node_modules/@babel/parser/lib/index.js:9043:23)
    at _class.tsParseArrayTypeOrHigher (/testproject/node_modules/@babel/parser/lib/index.js:9050:23)
    at _class.tsParseTypeOperatorOrHigher (/testproject/node_modules/@babel/parser/lib/index.js:9094:122)
    at _class.tsParseUnionOrIntersectionType (/testproject/node_modules/@babel/parser/lib/index.js:9099:18)
    at _class.tsParseIntersectionTypeOrHigher (/testproject/node_modules/@babel/parser/lib/index.js:9117:19)
    at _class.tsParseUnionOrIntersectionType (/testproject/node_modules/@babel/parser/lib/index.js:9099:18)

I’m getting this error which lets me think that babel is trying to transform the code before the typescript transformer jumps in.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12

github_iconTop GitHub Comments

9reactions
vovkasmcommented, Sep 23, 2018

For people that still want to use this module, solution is simple. In file rn-cli.config.js remove keys getTransformModulePath and getSourceExts, and add section:

  transformer: {
    babelTransformerPath: require.resolve('react-native-typescript-transformer'),
  },

For documentation, see https://facebook.github.io/metro/docs/en/configuration

4reactions
dalcibcommented, Aug 26, 2018

Since the version 0.43.3, Metro has native support for Typescript by Babel 7.0.0 Plugin. See Add TypeScript support to React Native and #209 The react-native 0.57-rc3 comes with Metro 0.43.6 I don’t know how it can afect this package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native run-ios 0.57.x is broken #21741 - GitHub
I was able to fix a few issues by using "legacy build mode" in XCode 10 (see File -> Workspace Settings -> Build...
Read more >
Upgrading to new versions - React Native
Upgrading to new versions of React Native will give you access to more APIs, views, developer tools and other goodies.
Read more >
React native version updating not working - Stack Overflow
I tried to update my "React-native" version to 0.59.0 from 0.57.8, but it is not updating. react-native upgrade 0.59.0-rc.0 this command is ...
Read more >
Accessibility - React
Web accessibility (also referred to as a11y) is the design and creation of websites that can be used by everyone. Accessibility support is...
Read more >
Version History - ReactXP
A new version of ReactXP will be released periodically following the same general update timeline of React Native. Each new version will get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found