Day 173 of Learning MERN Stack

์ž‘์„ฑ์ž

์นดํ…Œ๊ณ ๋ฆฌ:

โ† ํ”ผ๋“œ๋กœ
DEV Community ยท Ali Hamza ยท 2026-08-16 ๊ฐœ๋ฐœ(SW)

Ali Hamza

Hello Dev Community! ๐Ÿ‘‹

It is officially Day 173 of my full-stack engineering track! Today, I explored one of the core mechanisms that make TypeScript powerful and developer-friendly: Type Inference vs. Type Annotations! ๐Ÿ“˜โšก

Understanding when to let the TypeScript compiler infer types automatically versus declaring them explicitly makes codebases cleaner and more maintainable.

๐Ÿ› ๏ธ Technical Breakdown: Inference vs. Annotations

As captured in my code editor setup (index.ts):

1. Type Inference (Implicit Typing)

  • TypeScript automatically determines the variable type based on its initial assigned value:

typescript
  let drink = "Chai peyo"; // Inferenced as type string
  // drink = 0; // Error: Type 'number' is not assignable to type 'string'.

Enter fullscreen mode Exit fullscreen mode

์›๋ฌธ์—์„œ ๊ณ„์† โ†—

์ถ”์ถœ ๋ณธ๋ฌธ ยท ์ถœ์ฒ˜: dev.to ยท https://dev.to/ali_hamza_589ec7b3eb6688d/day-173-of-learning-mern-stack-36b5