Skip to content

Conversation

sori4606
Copy link
Collaborator

요구사항

기본

  • [x]
  • []
  • []

심화

  • [x]
  • []

주요 변경사항

스크린샷

image

멘토에게

  • typescript로 바꿨습니다.
  • 저번에 해주신 코드 리팩토링 아직 적용 못했습니다.

@sori4606 sori4606 requested a review from devToram January 26, 2025 15:53
@sori4606 sori4606 added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Jan 26, 2025
Copy link
Collaborator

@devToram devToram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입스크립트 적용이 주요 내용인 거 같아서 타입을 중심으로 봤습니다!
설 연휴에 수고 많으셨어요! 해피설되셔요 😍

interface PostCommentDataParams {
productId?: string;
editContent: string;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입이 꽤 많아서 따로 type.ts 에 정의해도 괜찮을 거 같아요!

</li>
))}
{allItemList.map(
({ id, images, name, price, favoriteCount }: Product) => (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allItemList가 Product[] 타입인 것을 위에 정의할 때에 vsCode 에게 알려줬기 때문에 여기는 따로 적을 필요 없을 거 같아요!

Suggested change
({ id, images, name, price, favoriteCount }: Product) => (
({ id, images, name, price, favoriteCount }) => (

Comment on lines +84 to +85
const created: number = new Date(createdAt).getTime();
const updated: number = new Date(updatedAt).getTime();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +6 to +13
interface ProductItemData {
id: number;
imageUrl: string;
name: string;
price: number;
likeCount: number;
size: number;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpecificProductProps 에 모두 있는 요소인 거 같은데, 물론 요소만 비슷하고, 전혀 관계없는 타입인 경우엔 상관없지만, ProductItemData 중에 특정 상품의 경우 더 많은 정보가 주어지는 경우 type SpecificProductProps = ProductItemData extends {..} 요런식으로 짜줘도 좋을 거 같아요!

@devToram devToram merged commit 456b287 into codeit-bootcamp-frontend:React-송형진 Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants