0

I am trying to compile and run my react app and I am running into an error:

Parsing error: Unexpected token
declare global {
  namespace JSX {
    interface IntrinsicElements {
      textMeshImpl: TextMesh;
    }
  }
}

Is this something to do with eslint?

  • Where are you getting this error? What's the full error message? What's the context? If it's ESLint error, it *should* say ESLint as part of the error message. If not, then perhaps your code is wrong. – VLAZ Jan 03 '21 at 15:17
  • That was the full error message. I am getting this error in Text.tsx which is a file for one of my components. I am working off this codepen: https://codesandbox.io/embed/r3flex-jbgrq. It works on codepen. It doesnt work when I try to work on it locally. – Benjamin Ha Jan 03 '21 at 15:24
  • TLDR add `export {};`; https://stackoverflow.com/questions/57132428/augmentations-for-the-global-scope-can-only-be-directly-nested-in-external-modul – ABOS Jan 03 '21 at 16:40
  • export is there already 'export const Text = forwardRef(' but I also added export to the beginning and it still has the parsing error. – Benjamin Ha Jan 03 '21 at 16:44
  • In case you're using VS Code, place mouse above the line which throws error, and a popup would appear with more slightly more details. Moreover, I don't think you've posted the entire error message. There must be something after the phrase **unexpected token**. – Vinay Sharma Jan 03 '21 at 16:58
  • Im using VS code and thats all I am given. Additionally, the line isn't throwing an error in the editor only when compiling. – Benjamin Ha Jan 03 '21 at 17:00
  • Sounds like ESLint isn't configured for TypeScript – Aluan Haddad Jan 04 '21 at 02:02

0 Answers0