Unexpected token '.'

I’ve run into a problem where my app, running through Expo (SDK30), displays Unexpected token ‘.’ at startup. After testing a few things I’ve found that it’s fine on my iPhone, but on both Android devices it shows the error. I tried using Remote Debugging to see if that would help identify the problem, but it works in that mode!

I’m hoping these details will prompt someone to say “it’s probably this”. If not, I’ll just start rolling back my recent changes until I get it working again (I’ve been testing on iOS for a few days, so have no idea when the problem was introduced).

Also, I’m using TypeScript if that makes a difference.

Just following up to say I found the problem. I have a custom error class that extends Error, and in order to use if (error instanceOf MyCustomError) {} I read online that I needed to restore the prototype chain using “new.target.prototype”.

Apparently “new.target” is what it didn’t like. When I changed that to “MyCustomError.prototype” it works great.

Hey @rickparrish,

Glad you figured out the issue and thanks for sharing with the community!

Cheers,

Adam

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.