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. Type Alias (টাইপ অ্যালিয়াস)
TypeScriptBeginner

Type Alias (টাইপ অ্যালিয়াস)

Type alias দিয়ে নামকৃত reusable টাইপ — object, function, union, intersection — বাংলায় সম্পূর্ণ গাইড।

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

Type alias হলো একটি টাইপের নাম দেওয়া। একবার টাইপ বানালে বারবার ব্যবহার করা যায় — type কীওয়ার্ড দিয়ে।

Type Alias কী?

type দিয়ে primitive, object, union, function — যেকোনো টাইপকে একটি নাম দেওয়া যায়। এরপর সেই নাম দিয়েই annotation করলেই হয়।

Basic Type Alias

type UserId = string;
type Score = number;

let userA: UserId = "u-101";
let marks: Score = 95;

Object Type Alias

type User = {
  name: string;
  age: number;
  email?: string;
  readonly id: number;
};

const user: User = {
  id: 1,
  name: "রহিম",
  age: 28,
};

Function Type Alias

type Formatter = (value: string) => string;

const upper: Formatter = (value) => value.toUpperCase();
const reverse: Formatter = (value) => value.split("").reverse().join("");

console.log(upper("bangla"));    // BANGLA

Union Type Alias

type ID = string | number;
type Status = "pending" | "active" | "blocked";

function printId(id: ID): void {
  console.log("ID:", id);
}

printId("a-1");
printId(10);
// printId(true);   // ❌ boolean যাবে না

Intersection Type Alias

type HasName = { name: string };
type HasAge = { age: number };

type Person = HasName & HasAge;

const person: Person = {
  name: "রহিম",
  age: 28,
};

Reusable Type Definitions

একটি টাইপ অনেক জায়গায় ব্যবহার করলে কোড dry (reusable) থাকে — প্রপার্টি বদলালে শুধু এক জায়গায় বদলাই যথেষ্ট।

type Coordinate = { x: number; y: number };

function moveTo(place: Coordinate): void {
  console.log(`যাচ্ছি ${place.x}, ${place.y}`);
}

function distance(a: Coordinate, b: Coordinate): number {
  return Math.hypot(a.x - b.x, a.y - b.y);
}
কবে type alias?

union, intersection, tuple, function signature — যেখানে interface পারে না, সেখানে type ঘরোয়া। object-এর জন্যও interface চমৎকার — পার্থক্য পরের অধ্যায়ে।

শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।
আগেরTypeScript Objects (অবজেক্ট)পরেরInterface (ইন্টারফেস)
এই পেজে
Tech Tutor

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

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

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

mdanamolhasan1998@gmail.com