Unexpected Token Error
See original GitHub issueTrying 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:
- Created 5 years ago
- Reactions:20
- Comments:17
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@d30jeff The problem is, as soon as I install
parcel-plugin-typescript
, Parcel treats TS files as JS, and fails with syntax errors.Any updates on this?