-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
해결됨
redux 예제코드 가져와서 강의 보면서 따라하는데
23.12.02 19:34 작성 조회수 111
1
//tsconfig.json strict:true 일때
const store = createStore(reducer, initialState, enhancer);
해당 부분에서 에러가 사라지지 않아서 createStore를 보니까
Argument of type '{ user: { isLoggingIn: boolean; loading: boolean; data: null; }; posts: never[]; }' is not assignable to parameter of type '{ user?: undefined; posts?: undefined; }'.
Types of property 'user' are incompatible.
Type '{ isLoggingIn: boolean; loading: boolean; data: null; }' is not assignable to type 'undefined'.ts(2345)
에러 메세지
user와 posts State가 never로 추론 되어지네요.
tsconfig.json 파일에서 strict: false로 바꾸면 정상적으로 추론 됩니다.
//tsconfig.json strcit: false일때
답변을 작성해보세요.
1
답변 1