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.

Unexpected Token Error

See original GitHub issue

Trying it with a simple Parcel setup, I get unexpected token error for TypeScript;

🚨  /home/azer/code/mobile/src/index.tsx:21:2: Unexpected token, expected "," (21:2)
  19 | ReactDOM.render(<Container>hey, there</Container>, document.getElementById(
  20 |   "root"
> 21 | ) as HTMLElement)
     |  ^

If I remove as HTMLElement from the line above, this time it’ll complain other TypeScript syntax.

Versions I tried:

Parcel: 1.10.1 TypeScript: 3.1.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:20
  • Comments:17

github_iconTop GitHub Comments

26reactions
azercommented, Oct 5, 2018

@d30jeff The problem is, as soon as I install parcel-plugin-typescript, Parcel treats TS files as JS, and fails with syntax errors.

13reactions
mtfranchettocommented, Dec 4, 2018

Any updates on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
JavaScript Error Handling: Unexpected Token - GeeksforGeeks
Not follow them throws an error.An unexpected token occurs if JavaScript code has a missing or extra character { like, ) + –...
Read more >
How to fix JavaScript unexpected token error
As you write your JavaScript application, the unexpected token error always occurs because JavaScript expected a specific syntax that's not ...
Read more >
How to fix: "SyntaxError: Unexpected token" in JavaScript
One common cause of the SyntaxError: Unexpected token error is a missing semicolon. In JavaScript, semicolons are used to indicate the end of...
Read more >
syntax error: unexpected token - javascript - Stack Overflow
The error SyntaxError: Unexpected token < likely means the API endpoint didn't return JSON in its document body, such as due to a...
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