Closed nicehyun closed 1 year ago
@ish1610 this는 기본적으로 어떤 객체가 자기 자신을 지칭할 때 쓰이는 대명사라고 생각하시면 되는데요. 전체 코드를 보진 않아서 잘 모르겠으나 this를 리턴해야 자기 자신을 다시 리턴하면서 메서드 체이닝을 이어나갈 수 있을 것 같습니다.
익숙한 예시로 Promise.then()의 경우에도 then()의 리턴 값으로 원래 프로미스 자기 자신을 리턴해야 그 뒤에 then, catch, finally 등의 메서드를 다시 호출할 수 있는 형태가 됩니다.
앗 감사합니다! 바로 이해됐어요 ㅜㅠ❗️
`
멘토님 예시 코드보면서 알게된 joi API 사용해보기 전 API를 직접 분석해보고 사용하려고 하는데 쉽지않네요..
혹시 allow(...values: any[]): this; 여기서 this가 무엇을 의미하는지 알 수 있을까여.. 이런식으로 this를 리턴한다는 것들이 많네요..