Closed kayzenkayzen closed 4 years ago
I Fix this using:
wrapper: { } as uknown as React.CSSProperties
I am getting this as well, and adding as unknown
before does not fix it for me, it just moves the error to the as in the unknown I just added.
The {} as unknown as <some other type>
trick only helps if you've enabled the no-object-literal-type-assertion
rule.
Thank you for the issue. Now that @babel/eslint-parser
has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.
I have this code:
const styles = { wrapper: { maxWidth: 1200, display: 'flex', flexDirection: 'column', justifyContent: 'center', margin: '0 auto', background: '#f1f1f1', padding: 35, } as React.CSSProperties }
And I get this eslint error:
`Parsing error: Unexpected token, expected ","
13 | background: '#f1f1f1', 14 | padding: 35,
this is my .eslintrc.json
{ "env": { "browser": true, "es6": true }, "parser": "babel-eslint", "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" }, "parserOptions": { "ecmaFeatures": { "jsx": true, }, "ecmaVersion": 2018, "sourceType": "module" }, "plugins": [ "react" ], "overrides": [ { "files": [".test."], "plugins": ["jest"] } ], "rules": { "indent": [2, 4] } }
If I use '@typescript-eslint/parser' I don't get this error, is there something wrong in my configuration?