codestates / codestates/Lumiere
[에러 핸들링] TypeScript에서 localstorage 불러올때 Type 'null' is not assignable to type 'string'
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description

```tsx
setIsLiked(
!![res.data][0].artistDetail.likes.find(
(el) =>
el === JSON.parse(localStorage.getItem('lumiereUserInfo'))._id,
),
);
```
위 코드를 아래와 같이 바꾸면 해결된다.
```tsx
setIsLiked(
!![res.data][0].artistDetail.likes.find(
(el) =>
el === JSON.parse(localStorage.getItem('lumiereUserInfo' || '{}'))._id,
),
);
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.