Typescript
-
Effective Typescript - type을 value들의 집합이라 생각하기Typescript 2023. 9. 3. 22:20
🔔 서론 뭐했는지 벌써 8월이 끝나고 9월이 찾아왔다. 이래 저래 고민이 많은 시기인데.. 이런 고민에 대한 얘기는 월 회고록에 주저리주저리 얘기해보도록 하고, 이번 주 WIL은 프로그래머스 데브코스에서는 react 과제를 수행하느라 별 다른 학습을 진행하진 않았고, 대신 effective typescript 스터디를 하면서 읽은 내용중 인상깊었던 내용에 대해서 정리를 해보려고한다. 🔔 타입이 값들의 집합이라고 생각하기 타입스크립트의 런타임에서 모든 변수는 자바스크립트의 값으로부터 정해지는 각자의 고유한 값을 가진다. 예를들어 변수는 다음과 같은 다양한 값을 가질 수 있다. 42 null undefined 'abcd' (a, b) => a + b {name: 'kim'} 이들은 코드를 실행하기 전, 타입..
-
typescript - exercises 4일차Typescript 2023. 7. 13. 16:36
🔔 서론 원래 남은 4문제를 이틀에 걸쳐 두 문제씩 풀기로 계획했었는데, 알고보니 16번 문제가 없어서 3문제를 이틀에 걸쳐 풀기엔 낭비인 것 같아서 남은 문제를 모두 풀기로 했다.. 파이팅.. https://typescript-exercises.github.io/ TypeScript Exercises A set of interactive TypeScript exercises typescript-exercises.github.io 이번 포스트는 위 사이트의 13~15번 문제를 풀며 각 문제 풀이에 해당하는 핵심 키워드 개념을 정리하는 글이다. 🥁 13번 interface merging을 사용해 index.d.ts 파일을 완성시키는 문제이다. 🌈 Interface Merging interface mergi..
-
typescript - exercises 3일차Typescript 2023. 7. 12. 15:47
🔔 서론 어느덧 3일차에 접어든 typescript exercises 스터디, 아마 오늘이 가장 고비가 아닐까 싶다. 총 16문제를 5일에 걸쳐 4, 4, 4, 2, 2 문제씩 풀기로 했기때문에 난이도가 어느정도 높으면서 많은 문제를푸는 마지막 날이기 때문이다. 문제를 접하고나니 역시 예상대로 난이도가 너무나도 높아서 좌절하고 싶었지만.. 그만큼 아직 배울게 많이 남아 있다는거니까 아무래도 좋다.. 중요한건 꺾이지 않는 마음일 것. https://typescript-exercises.github.io/ TypeScript Exercises A set of interactive TypeScript exercises typescript-exercises.github.io 이번 포스트는 위 사이트의 9~12번..
-
typescript - exercises 2일차Typescript 2023. 7. 11. 16:38
🔔 서론 1일차가 지나고 다음 문제를 풀려는데 5번부터 막혀 부족함을 깨달아서 상당히 스스로에게 화가 난 상태로 문제를 풀어냈다... (화가 난 상태면 내가 뭘 할 수 있는데ㅋㅋ) https://typescript-exercises.github.io/ TypeScript Exercises A set of interactive TypeScript exercises typescript-exercises.github.io 이번 포스트는 위 사이트의 5~8번 문제를 풀며 각 문제 풀이에 해당하는 핵심 키워드 개념을 정리하는 글이다. 🥁 5번 Utility type을 적절히 사용하여 타입의 변환을 주는 문제이다. 문제의 요구사항에서 '필요한 기준'만 통과 되게끔 filterUsers를 변경해야한다 라고 서술했고,..
-
typescript - exercises 1일차Typescript 2023. 7. 11. 03:41
🔔 서론 데브코스 노션 클론 과제가 끝나고 잠깐의 숨 돌릴 틈이 주어진 어느 날, 같은 팀원이 한 가지 제안을 했다. 곧 typescript 강의가 시작되기 전 개념공부를 하면서 문제를 풀어보고 개념을 정리해 발표하는 스터디를 해보는게 어떻겠냐고.. typescript 공부를 안그래도 하려던 참이었기에 기쁜 마음으로 참여를 희망했다. https://typescript-exercises.github.io/ TypeScript Exercises A set of interactive TypeScript exercises typescript-exercises.github.io 팀원분이 "위 사이트의 문제를 그래도 최소 12번까지는 풀 수 있으면 내 기술 스택에 typescript를 자랑스럽게 적어도 된다"라는 ..
-
useRef current 객체의 생성 시점에 따른 ref 접근방식Typescript 2023. 5. 8. 18:26
react Js로 작성한 인스타그램 클론코딩을 typescript로 migrate 하는 작업을 하던 중 생각지도 못한 자주 발생한 에러들이 있었다. 바로 useRef를 사용해 컴포넌트에 직접 접근하려고 할 때 발생한 이 오류이다. 처음에는 초기값을 지정해 주지 않아 발생한 오류라고 생각해 수정했었으나.. 단순히 useRef 초기값을 null로 지정해주면 해결될 문제인줄 알았더니 그것 또한 아니었다 미리 스포하자면 inputRef.current가 존재하면 inputRef.current.focue()를 실행하라고 조건을 주면 해결되긴 했지만 근본적으로 왜 이런 문제가 발생되는지 알기위해서 먼저 useRef()에 대해 알아보아야 한다 useRef란 useRef는 프로퍼티에 변경 가능한 값을 담고 있는 '상자'..