When I use @babel/parser to parse other people's code, I occasionally run into parsing errors, such as VarRedeclaration, UnexpectedToken, etc. #15049
-
When I use @babel/parser to parse other people's code, I occasionally run into parsing errors, such as VarRedeclaration, UnexpectedToken, etc. For example, the code looks like this:
and My code look like this:
|
Beta Was this translation helpful? Give feedback.
Answered by
nicolo-ribaudo
Oct 16, 2022
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nicolo-ribaudo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see
<searchSubscriptionItem>{}
in that code: that syntax is only valid when thejsx
plugin is disabled. You can test it on the TS playground too: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAKjgQwM5wPpwGZQiOAcgBsIATNAC0IG4AoUSWOAbzggCNUBTKAN2Qdi3ADQoAxjGAQAdmPH4wAVxjcycAL448BQiE4APWnToB6U3G6piwGTAC0ZYKkHD7M7gYc2PcAAIwAJ5gVuJQwGAOVj4wpjLIILYA5vYKMnzcdtIydJ5M8LaqUNjI4txwPMhQ4pQAykpcYRFSsgCSqgQsdHAVDahNkdkAqjLZrWQA-ABcFTDhMkk0cObdcMCTM6hzyfQ98SDcm9sLS3QaJnnQ8GTcJUrE8OLEaOi13FU19Y3hg7K1MNByl0en5ODx+K5ypVqnU+gMWjIADLOGCbd4wr79H4I9rcEAAbQAunAALxwIn0Vagri8ARCKGBLZ4t4fWHfZrZZFbNGszHwsYdImk8mEymrcyWayFRzOSHuTzeWzlALBULY+zRQqmNKoFGZBxBEL2F68BGoKlg2mQuDiJRQKD6vnY7I8jFw51tDrCgA80M+7o5nrx…