[송형진] sprint8#318
Hidden character warning
[송형진] sprint8#318devToram merged 1 commit intocodeit-bootcamp-frontend:React-송형진from sori4606:React-송형진
Conversation
devToram
left a comment
There was a problem hiding this comment.
타입스크립트 적용이 주요 내용인 거 같아서 타입을 중심으로 봤습니다!
설 연휴에 수고 많으셨어요! 해피설되셔요 😍
| interface PostCommentDataParams { | ||
| productId?: string; | ||
| editContent: string; | ||
| } |
There was a problem hiding this comment.
타입이 꽤 많아서 따로 type.ts 에 정의해도 괜찮을 거 같아요!
| </li> | ||
| ))} | ||
| {allItemList.map( | ||
| ({ id, images, name, price, favoriteCount }: Product) => ( |
There was a problem hiding this comment.
allItemList가 Product[] 타입인 것을 위에 정의할 때에 vsCode 에게 알려줬기 때문에 여기는 따로 적을 필요 없을 거 같아요!
| ({ id, images, name, price, favoriteCount }: Product) => ( | |
| ({ id, images, name, price, favoriteCount }) => ( |
| const created: number = new Date(createdAt).getTime(); | ||
| const updated: number = new Date(updatedAt).getTime(); |
There was a problem hiding this comment.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime
Date 객체의 .getTime() 메서드는 기본적으로 number 를 리턴하기에 명시해주지 않아도 될 거 같아요!
다만 잘못된 값의 경우 NaN 를 리턴하기에 이에 대한 예외처리도 있으면 좋을 거 같아요~
|
|
||
| //omit으로 size 속성 제외 | ||
| interface ItemData | ||
| extends Omit<SpecificProductProps, "size" | "imageUrl" | "likeCount"> { |
| interface ProductItemData { | ||
| id: number; | ||
| imageUrl: string; | ||
| name: string; | ||
| price: number; | ||
| likeCount: number; | ||
| size: number; | ||
| } |
There was a problem hiding this comment.
SpecificProductProps 에 모두 있는 요소인 거 같은데, 물론 요소만 비슷하고, 전혀 관계없는 타입인 경우엔 상관없지만, ProductItemData 중에 특정 상품의 경우 더 많은 정보가 주어지는 경우 type SpecificProductProps = ProductItemData extends {..} 요런식으로 짜줘도 좋을 거 같아요!
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게