You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the error when parsing this file using "closure2ts Clustering.js Clustering.d.ts". Of course this happens with every file containing import statements :)
C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:3385
throw error;
^
Error: Line 2: Unexpected token
at ErrorHandler.constructError (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:3390:22)
at ErrorHandler.createError (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:3408:27)
at Parser.unexpectedTokenError (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:542:39)
at Parser.tolerateUnexpectedToken (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:555:42)
at Parser.parseStatementListItem (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:1801:31)
at Parser.parseProgram (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:3054:29)
at Object.parse (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\node_modules\esprima\dist\esprima.js:117:24)
at Object.jsdoc (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\definition-generator\src\parser.js:412:24)
at symbols (C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\definition-generator\src\finder.js:30:59)
at C:\Users\sevef\AppData\Roaming\npm\node_modules\typescript-closure-tools\definition-generator\src\finder.js:70:21
The text was updated successfully, but these errors were encountered:
I know this has something to do with the esprima parsing infrastructure and it seems it doesn't like the "import" and "export" statements but maybe you have experienced this issue before and can help me.
Btw it works with the esprima online parser.
Otherwise I'm going to create an issue at the esprima project.
I've debugged the code and I think the problem is that there is a difference parsing a "script" or a "module". You have to set 'sourceType' to "script" or "module" in the esprima.parse options, f.e. (end of parser.js): var tree = esprima.parse(code, { attachComment: true, sourceType; 'script' });
When setting it to module my file will be parsed without any errors.
Do you want me to create a PR for this or do you fix it on your own?
This is the error when parsing this file using "closure2ts Clustering.js Clustering.d.ts". Of course this happens with every file containing import statements :)
The text was updated successfully, but these errors were encountered: