clasp: clasp push fails due to spurious syntax errors that can't be investigated
(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)
I have a project that used to work fine. I recently updated to a new computer and installed everything fresh, so it is possible that is somehow related, but my underlying problem is still valid.
Expected Behavior
My code can by transpiled to Javascript successfully, but when I run clasp push it fails. Furthermore, the failure message isn’t useful. It should either show enough info that can be used to investigate the error, or there should be a way to preserve the generated .gs files so they can be examined directly.
Actual Behavior
When I run clasp push I get errors like Syntax error: ParseError: Unexpected token ; line: 9 file: Documents/Order.gs. This .gs file is not available for to see, so I can’t examine what is wrong with line 9. Furthermore, my original code in Typescript, so the difference between my source and this file that has an error is significant.
Specifications
- Node version (
node -v): 17.4.0 - Version (
clasp -v): 2.4.1 - OS (Mac/Linux/Windows): macOS 12.2 with M1 silicon
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 24 (11 by maintainers)
Aha! If I change it to
"target": "ES2019"then it works. I think that might be the key. Also, looking at the clasp typescript docs it says you should target ES2019. Doh, RTFM, 🤦.