Tech TutorBangla Web Documentation
Portfolio
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • TypeScript Documentation28টি অধ্যায়
প্রযুক্তি নির্বাচন
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Introduction
  • Installation
  • Basic Types
  • Variables & Inference
  • Functions
  • Objects
  • Type Alias
  • Interface
  • Union & Intersection
  • Type Narrowing
  • Type Guards
  • Enums
  • Generics
  • Classes
  • Utility Types
  • Type Assertion
  • Async TypeScript
  • Conditional Types
  • Mapped Types
  • Template Literal Types
  • tsconfig Options
  • Modules & Types
  • Decorators
  • React + TypeScript
  • Node.js + TypeScript
  • JS → TypeScript
  • Common Errors
  • Mini Project
  1. Docs
  2. TypeScript
  3. সাধারণ TypeScript Error ও সমাধান
TypeScriptIntermediate

সাধারণ TypeScript Error ও সমাধান

object is possibly undefined, not assignable, Cannot find module, union call-ভুল — common TS errors ও fix বাংলায়।

14টি অংশবাংলা ভাষায়

প্রতিদিনের কাজে সবচেয়ে বেশি যেসব TypeScript error দেখা যায়, ঝটপট সেগুলোর সমাধান — এক নজরে।

object is possibly 'undefined'

type User = { name: string };

function show(user: User | undefined): void {
  // console.log(user.name);       // ❌ user ঠিকানা নয়
  if (user) {
    console.log(user.name);        // ✅ narrowing
  }
  console.log(user?.name);         // অথবা optional chaining
}

is not assignable to type

type Status = "pending" | "active";

const raw: string = localStorage.getItem("status") ?? "";
// const s: Status = raw;      // ❌ string broader

const s: Status = raw === "pending" || raw === "active" ? raw : "pending";

Property does not exist

interface User {
  id: number;
  name: string;
}

const user: User = { id: 1, name: "রহিম" };
// user.email                // ❌ property নেই
// interface-এ email?: string যোগ করুন

Cannot find module

// @types না থাকলে error দেখায়
// npm install -D @types/express

// অথবা নিজে module declar করুন
// declare module "my-lib";

Is not callable / union-এ access

type A = { name: string; action: () => void };
type B = { name: string; action: number };

function run(item: A | B): void {
  if (typeof item.action === "function") {
    item.action();      // ✅ narrowing পরে
  }
}

Error message পড়ার কৌশল

  • error-এর প্রথম লাইন = ঠিকানা (ফাইল:লাইন)
  • Type X is not assignable to Y — কোথায় কোন টাইপ লাগবে দেখুন
  • × অথবা hover-এ একাধিক overload দেখালে signature মিলিয়ে দেখুন
  • union-এ চলে গেলে প্রথমে narrowing করুন
error ভয় দেখাবে না

TypeScript error মানে কোডের সমস্যা — প্রায়ই টাইপ বরং সঠিক ধরন প্রকাশ করছে। ধীরে পড়ুন: ফাইল, type, প্রত্যাশিত — তিনটেই message-এ থাকে।

শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।
আগেরJavaScript থেকে TypeScript-এ রূপান্তরপরেরপ্র্যাকটিক্যাল মিনি প্রজেক্ট (Todo CLI)
এই পেজে
Tech Tutor

বাংলায় ওয়েব ডেভেলপমেন্ট ডকুমেন্টেশন শিখুন — ধাপে ধাপে।

Homeসব ডকুমেন্টেশনQuick Startআমার নোটস

© 2026 Tech Tutor. বাংলায় শিখুন, বাংলায় গড়ুন।

mdanamolhasan1998@gmail.com