2024-05-13.md

🏑

DIL: μ΄νŽ™ν‹°λΈŒ νƒ€μž…μŠ€ν¬λ¦½νŠΈ

μŠ€ν„°λ””: μ›”κ°„ CS, https://github.com/monthly-cs/2024-05-effective-typescript
μž‘μ„±μΌ: 2024-05-13
μž‘μ„±μž: dusunax


2μž₯. νƒ€μž…μŠ€ν¬λ¦½νŠΈμ™€ νƒ€μž… μ‹œμŠ€ν…œ

μ•„μ΄ν…œ 6: editorλ₯Ό μ‚¬μš©ν•˜μ—¬ νƒ€μž… μ‹œμŠ€ν…œ νƒμƒ‰ν•˜κΈ°

  • tsc: νƒ€μž…μŠ€ν¬λ¦½νŠΈ 컴파일러
  • tsserver: λ‹¨λ…μœΌλ‘œ μ‹€ν–‰ν•  수 μžˆλŠ” νƒ€μž…μŠ€ν¬λ¦½νŠΈ μ„œλ²„, μ–Έμ–΄ μ„œλΉ„μŠ€ 적용

μ–Έμ–΄ μ„œλΉ„μŠ€λŠ”?

  • μ½”λ“œ μžλ™ μ™„μ„±, λͺ…μ„Έ specification 검사, 검색, λ¦¬νŒ©ν„°λ§
  • μΆ”λ‘  정보λ₯Ό 디버깅에 μ‚¬μš©

νƒ€μž… λ„“νžˆκΈ°, 쒁히기

  • 쑰건문 λΆ„κΈ°μ—μ„œ κ°’μ˜ νƒ€μž… λ³€ν™”
  • 객체의 κ°œλ³„ 속성 μΆ”λ‘ 
  • μ—°μ‚°μž 체인 쀑간 μΆ”λ‘ λœ μ œλ„ˆλ¦­ νƒ€μž… -> λ©”μ„œλ“œ 이름을 쑰사

Go To Definition

  • 라이브러리, 라이브러리의 νƒ€μž… 선언을 탐색할 λ•Œ 도움이 됨
    • d.ts 파일

μš”μ•½

Things to Remember

  • Take advantage of the TypeScript language services by using an editor that supports them.
    • νŽΈμ§‘κΈ°μ—μ„œ νƒ€μž…μŠ€ν¬λ¦½νŠΈ μ–Έμ–΄λ₯Ό ν™œμš©ν•œλ‹€
  • Use your editor to build an intuition for how the type system works and how TypeScript infers types.
    • νŽΈμ§‘κΈ°λ₯Ό μ‚¬μš©ν•΄μ„œ μ–΄λ–»κ²Œ νƒ€μž… μ‹œμŠ€ν…œμ΄ λ™μž‘ν•˜λŠ” 지, νƒ€μž…μŠ€ν¬λ¦½νŠΈκ°€ μ–΄λ–»κ²Œ νƒ€μž…μ„ μΆ”λ‘ ν•˜λŠ” 지 κ°œλ…μ„ μž‘λŠ”λ‹€
  • Familiarize yourself with TypeScript's refactoring tools, e.g., renaming symbols and files.
  • Know how to jump into type declaration files to see how they model behavior.
    • νƒ€μž…μŠ€ν¬λ¦½νŠΈκ°€ λ™μž‘μ„ μ–΄λ–»κ²Œ λͺ¨λΈλ§ν•˜λŠ” 지 μ•ŒκΈ° μœ„ν•΄ νƒ€μž… μ„ μ–Έ νŒŒμΌμ„ μ°Ύμ•„λ³΄λŠ” 방법을 ν„°λ“ν•œλ‹€