简体   繁体   中英

Redux typescript-eslint/no-unsafe-assignment - useDispatch

在此处输入图像描述

I am using React, TypeScript, ESlint, and TypeScript-ESlint. There are no issues with this.

When I installed Redux, React-Redux, and @types/react-redux, the Redux types are being ignored by TypeScript-ESlint. I also installed and uninstalled @types/redux.

Everything in the Redux API like useDispatch(), useSelector(), combineReducers() throws linting errors for "Unsafe assignment of an any value."

From the Redux Docs, useDispatch() should work without any special typing. 在此处输入图像描述

How can I configure TypeScript-ESlint to work with Redux?

Thanks!

Sometimes, the typescript language server within vs code has a hard time picking up changes to the types. Try to "Reload" it using the command palette or completely restarting vs code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM