I'm using useState in my react-native app as such:
const [loginDetails, setLoginDetals] = useState({});
When I try to access a property of loginDetails
, I get a ts(2339) error from eslint:
I don't really have any interfaces or classes set up for this, but it does get populated with those fields. They are just not explicitly defined.
My eslint and prettier configs are as follows:
eslint
{"extends": ["airbnb", "prettier"],"plugins": ["prettier"],"rules": {"prettier/prettier": ["error"],"no-console": "off","func-names": "off","no-underscore-dangle": "off","no-unused-vars": "warn" },"overrides": [ {"files": ["*.ts", "*.tsx"],"extends": ["airbnb","prettier","airbnb-typescript","prettier/@typescript-eslint" ],"plugins": ["prettier", "@typescript-eslint"],"parser": "@typescript-eslint/parser" } ]}
prettier
{"tabWidth": 4,"printWidth": 200,"singleQuote": true,"endOfLine": "auto","trailingComma": "all"}
This error does not cause any compile or runtime issues, but I'd still like to fix it.
What's the proper way to handle it?