보통 useSelector를 사용할 때 아래와 같이 store의 타입을 선언해줘야 했다.
const { data } = useSelector((state: RootState) => state.home);
아래와 같이 index.d.ts에 모듈 선언을 해주면 RootState 타입 선언 없이 사용 할 수 있다.
import 'react-redux';
import { RootState } from '@src/store/store';
declare module 'react-redux' {
interface DefaultRootState extends RootState { };
}
const { data } = useSelector(state => state.home);