My TypeScript code, which should work, is getting an error from my eslint:
const foo = {
key1: 'value1',
key2: 'value2'
};
type MyType = keyof typeof foo;
ESLint: Parsing error: Unexpected token `typeof`, expected the token `;`(prettier/prettier
The application was created using the create-react-app
tool with default eslint config and added prettier support. Here is the configuration:
// eslintrc
"extends": [
"react-app",
"react-app/jest",
"eslint:recommended",
"plugin:prettier/recommended"
],
Here is a screenshot of my IDE showing the error.
Any suggestions or ideas on how to fix this? Thank you!
Edit1: I discovered that the plugin:prettier/recommended
is causing the issue, but I would like to keep it if possible.