TypeError: _reactredux.useSelector.withTypes is not a function 3 import type { AppState…
- User
TypeError: _reactredux.useSelector.withTypes is not a function
3 | import type { AppState } from '../types'; 4 | > 5 | export const useAppSelector = useSelector.withTypes<AppState>(); - Assistant
The error message you're encountering,
TypeError: _reactredux.useSelector.withTypes is not a function, indicates that you're trying to use a methodwithTypeson theuseSelectorfunction from React Redux that does not exist.As of my last knowledge update, React Redux does not have a built-in method called
withTypesforuseSelector. Instead, you can achieve type safety for your Redux state by using TypeScript's generics directly withuseSelector.Here's how you can redefine your
useAppSelectorto properly type it for your app's state: - User
эта ошибка во всех тестах
- Assistant
- User
import { useSelector } from 'react-redux';
import type { AppState } from '../types';
export const useAppSelector = useSelector.withTypes(); Test suite failed to run
TypeError: _reactredux.useSelector.withTypes is not a function - Assistant
- User
test('Checking remove thunk reject', async () => { TestThunk.mockSpyOnThunkReturn(removeInitiateMock, Promise.reject()); TestThunk.mockSpyOnThunkReturn(showConfirmAppendixObjectAreaMock, Promise.resolve(true));
await removeThunk.callThunk({ documentId }); expect(pushNotifications.push).toHaveBeenCalledTimes(0); });[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefin ed".] { code: 'ERR_UNHANDLED_REJECTION' }
- Assistant