Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError on import type #91

Closed
wdoug opened this issue Jan 22, 2021 · 4 comments · Fixed by #106
Closed

SyntaxError on import type #91

wdoug opened this issue Jan 22, 2021 · 4 comments · Fixed by #106
Labels
bug Something isn't working

Comments

@wdoug
Copy link
Contributor

wdoug commented Jan 22, 2021

When running the ts-migrate-full or ts-migrate migrate command, if there are any included files (imported as a dependency of the sources somewhere) that use the TypeScript 3.8+ syntax import type, the script fails with a SyntaxError: Unexpected token referencing that syntax.

@wdoug
Copy link
Contributor Author

wdoug commented Jan 22, 2021

Oh, it looks like it is coming from the explicity-any plugin:

[explicit-any] Plugin 10 of 14. Start...
Error: [explicit-any][node_modules/@storybook/core/types/index.ts] Error:
SyntaxError: Unexpected token (1:12)
at Object.raise (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:3851:17)
at Object.unexpected (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:5165:16)
at Object.expectContextual (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:5131:41)
at Object.parseImport (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:8636:12)
at Object.parseImport (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:10345:18)
at Object.parseStatementContent (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:7391:27)
at Object.parseStatementContent (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:10401:18)
at Object.parseStatement (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:7293:17)
at Object.parseBlockOrModuleBlockBody (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:7879:25)
at Object.parseBlockBody (/Users/Will/projects/app/node_modules/@babel/parser/lib/index.js:7866:10) {
pos: 12,
loc: Position { line: 1, column: 12 }
}
[explicit-any] Finished in 6567.113ms.

@wdoug
Copy link
Contributor Author

wdoug commented Jan 22, 2021

My current guess is that jscodeshift might need to upgrade its version of @babel/parser and ts-migrate will need to subsequently upgrade its version of jscodeshift 😬

@wdoug
Copy link
Contributor Author

wdoug commented Jan 26, 2021

Opened an issue on jscodeshift to support the syntax: facebook/jscodeshift#409

@Rudeg Rudeg added the bug Something isn't working label Jan 28, 2021
@wdoug
Copy link
Contributor Author

wdoug commented Apr 21, 2021

jscodeshift has been updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants