I am using create-react-app
with TS and do import type
but eslint complains in VS Code saying that Parsing error: '=' expected
when hovering type
in import type
. I'm using eslint, 6.7.2
I answered the question about Remix: ParserError: Expected pragma. import directive, or contract/library/interface definition which is caused by the abstract keyword with solidity 0.5.0. By removing it you have a new error with the virtual keyword which has been introduced too by Solidity 0.6.0.
The TypeScript error "String literal expected" occurs when we have a syntax error, most often in an import statement. To solve the error, make sure to not use any variables when resolving your import paths and import as `import {myFunction} from './myFile'`.
error Parsing error: ',' expected at the last 3 lines of the code. This is the correct error. Your code is invalid. This is why you should avoid long complex lines like that. Check the bracket matching on your last line. Sorry, something went wrong. @bradzacher yeah, agreed. This code is invalid.
error Parsing error: ',' expected at the last 3 lines of the code. This is the correct error. Your code is invalid. This is why you should avoid long complex lines like that. Check the bracket matching on your last line.
UPDATE: The syntax is now supported by the latest versions of @typescript-eslint/parser
and @typescript-eslint/eslint-plugin
.
ESLint support for TS import type
syntax is working in progress.
Issue: https://github.com/typescript-eslint/typescript-eslint/issues/1436
Pull request: https://github.com/typescript-eslint/typescript-eslint/pull/1465
If you're using prettier rather than ESLint then the solutions is:
npm update prettier@latest
# Or yarn
yarn upgrade prettier@latest
Which installed prettier version "2.6.2". Which worked for me with import type { } from './types'
syntax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With