강의

멘토링

커뮤니티

Inflearn コミュニティ Q&A

rhkdtjd124829 のプロフィール画像
rhkdtjd124829

投稿した質問数

[リニューアル]タイプスクリプトオールインワン:Part2。実戦分析編

thunkミドルウェアの入力

redux 예제코드 가져와서 강의 보면서 따라하는데

解決済みの質問

作成

·

230

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일때

typescript

回答 1

1

zerocho님의 프로필 이미지
zerocho
インストラクター

strict: false로 하면 타입스크립트를 안 쓰는 것이나 다름없습니다. never가 나오는 것을 해결하셔야 합니다.

rhkdtjd124829님의 프로필 이미지
rhkdtjd124829
質問者

넵 알겠습니다. 해결 해보겠습니다

rhkdtjd124829 のプロフィール画像
rhkdtjd124829

投稿した質問数

質問する