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

Unexpected "}" #152

Open
JackGod001 opened this issue Dec 3, 2021 · 1 comment
Open

Unexpected "}" #152

JackGod001 opened this issue Dec 3, 2021 · 1 comment
Labels
bug Something isn't working question Further information is requested

Comments

@JackGod001
Copy link

JackGod001 commented Dec 3, 2021

When I run npx -p ts-migrate -c "ts-migrate-full ../frontend"
I got a lot of errors with the Unexpected "}"

code example
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ children: Element; title: string; fontSize... Remove this comment to see the full error message

Error: [declare-missing-class-properties][src/app/views/dashboard/shared/TopSellingTable.tsx] Error: SyntaxError: Unexpected token, expected "}" (49:76) at Object._raise (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:541:17) at Object.raiseWithData (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:534:17) at Object.raise (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:495:17) at Object.unexpected (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:3580:16) at Object.expect (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:3554:28) at Object.jsxParseExpressionContainer (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:7331:10) at Object.jsxParseElementAt (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:7422:36) at Object.jsxParseElementAt (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:7407:32) at Object.jsxParseElement (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:7465:17) at Object.parseExprAtom (/Users/baishaojie/python/django_react/frontend/node_modules/@babel/parser/lib/index.js:7472:19) { loc: Position { line: 49, column: 76 }, pos: 1995, code: 'BABEL_PARSER_SYNTAX_ERROR',

I found that the error was caused by the interception of the wrong content. In ts-ignore.js 43 lines of slice in the file.

const tsIgnoreCommentText = @${errorExpression} ts-migrate(${code}) FIXME: ${message.length > TS_IGNORE_MESSAGE_LIMIT
? ${message.slice(0, TS_IGNORE_MESSAGE_LIMIT)}... Remove this comment to see the full error message
: message};

@JackGod001 JackGod001 changed the title Unexpected token, expected "}" Unexpected "}" Dec 5, 2021
@devinrhode2
Copy link

Skip the class transformations altogether. Use vscode glean extension to just convert class components to hooks.

Assuming you are using react

@Rudeg Rudeg added bug Something isn't working question Further information is requested labels Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants