Skip to content

Conversation

@younoah
Copy link
Member

@younoah younoah commented Mar 15, 2022

🚅 PR 한 줄 요약

axios 응답의 데이터 타입 명시

🧑‍💻 PR 세부 내용

  • axios 응답의 데이터 타입이 any인 현상을 발견하여 응답의 데이터 타입을 명시하였습니다.
  • 'LikeType', 'CommentType'을 추가로 명시하였습니다.

LikeType

export type LikeType = {
  id: string;
  userId: string;
  waffleCardId: string;
};

CommentType

export type CommentType = {
  id: string;
  user: {
    id: string;
    name: string;
  };
  waffleCardId: string;
  text: string;
  createdAt: string;
  updatedAt: string;
};

@netlify
Copy link

netlify bot commented Mar 15, 2022

✔️ Deploy Preview for wafflecard ready!

🔨 Explore the source changes: 862d967

🔍 Inspect the deploy log: https://app.netlify.com/sites/wafflecard/deploys/623012aefc757100087dbe2a

😎 Browse the preview: https://deploy-preview-35--wafflecard.netlify.app

@yyoooon
Copy link
Collaborator

yyoooon commented Mar 15, 2022

확인했습니다~~
근데 export 할 때는 왜 interface가 아닌 type을 쓰시나요??

@younoah
Copy link
Member Author

younoah commented Mar 15, 2022

@yyoooon
export할 때 type을 사용하는게 아닌

interface와 type의 사용 기준에 따라 작성하려고 합니다.

의미적인 기준으로만 봤을 때는

  • interface는 이름 그대로 모듈(api)의 규약을 명시할 때 사용하려고 합니다.
  • LikeType과 CommentType같은 데이터의 타입을 명시할 때는 type을 사용하려고 합니다.

@yyoooon
Copy link
Collaborator

yyoooon commented Mar 16, 2022

아하 디테일 좋네요~~!
근데 type은 프로퍼티 확장이 용이하지 않은 걸로 아는데
확장하는 경우는 제외하신 건가요??
위에 타입들은 확장할 일이 없어서??

@younoah
Copy link
Member Author

younoah commented Mar 16, 2022

@yyoooon

윤님이 말씀하시는 확장은 어떤것을 말씀하신건가요?!? 선언적 확장??? 아니면 상속확장인가요?

@yyoooon
Copy link
Collaborator

yyoooon commented Mar 16, 2022

@younoah
상속확장을 말한거였어요!!
근데 찾아보니 type도 &써서 상속확장이 되긴하네요..!
선언적 확장은 안되구

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants