<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Md Ismail Ahammed Roman</title>
    <description>The latest articles on Forem by Md Ismail Ahammed Roman (@mdismailahammedroman).</description>
    <link>https://forem.com/mdismailahammedroman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F969379%2F541ad2c9-fe5f-4f33-ae9d-0d643d25048f.jpeg</url>
      <title>Forem: Md Ismail Ahammed Roman</title>
      <link>https://forem.com/mdismailahammedroman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mdismailahammedroman"/>
    <language>en</language>
    <item>
      <title>What are some differences between interfaces and types in TypeScript?</title>
      <dc:creator>Md Ismail Ahammed Roman</dc:creator>
      <pubDate>Fri, 09 May 2025 06:11:30 +0000</pubDate>
      <link>https://forem.com/mdismailahammedroman/what-are-some-differences-between-interfaces-and-types-in-typescript-4ghj</link>
      <guid>https://forem.com/mdismailahammedroman/what-are-some-differences-between-interfaces-and-types-in-typescript-4ghj</guid>
      <description>&lt;h2&gt;
  
  
  What is TypeScript?
&lt;/h2&gt;

&lt;p&gt;TypeScript is a high-level programming language developed by Microsoft. It adds static typing to JavaScript and is considered a superset of JavaScript. When programmers create large-scale projects with JavaScript, it can be difficult to understand what type of data is being passed, since JavaScript is a loosely typed language. This is why TypeScript has become popular.&lt;/p&gt;

&lt;p&gt;When a programmer writes code in TypeScript, the compiler shows an error if the wrong type is used. It helps catch type-related errors during development, improving productivity and reducing bugs, making it easier to build more reliable and maintainable projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are some differences between interfaces and types in TypeScript?&lt;/strong&gt;&lt;br&gt;
In TypeScript, a type is used to define the kind of data a variable can hold.&lt;br&gt;
When programmers write code like &lt;/p&gt;

&lt;p&gt;&lt;code&gt;let name: string = 'ismail';     // string&lt;br&gt;
let value: number = 111;         // number&lt;br&gt;
let isAdmin: boolean = true;     // boolean&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
BUT TYPESCRIPT IS NOT THE RIGHT WAY TO WRITE CODE.&lt;br&gt;
&lt;code&gt;&lt;br&gt;
let names:string='ismail'///string&lt;br&gt;
let value:number=111;// number&lt;br&gt;
let isAdmin:boolean= true||false;// boolean&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
But it's not reusable. If you need the same structure in multiple places, you can define a custom type:&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
type UserDetails = {&lt;br&gt;
  name: string;&lt;br&gt;
  age: number;&lt;br&gt;
};&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
 Now we can access and reuse this code. type user&lt;br&gt;
 interface and type are same syntax interface assign with assing oparetor and type use assing oparetor&lt;br&gt;
`&lt;br&gt;
let userInfo: UserDetails = {&lt;br&gt;
name: "ismail",&lt;br&gt;
age: 29&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;Difference Between Type and Interface&lt;/p&gt;

&lt;p&gt;// Using type&lt;br&gt;
type User = {&lt;br&gt;
name: string;&lt;br&gt;
age: number;&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;// Using interface&lt;br&gt;
interface User2 {&lt;br&gt;
name: string;&lt;br&gt;
age: number;&lt;br&gt;
}&lt;br&gt;
An interface extending person&lt;br&gt;
interface Person {&lt;br&gt;
name: string;&lt;br&gt;
}&lt;br&gt;
interface Employee extends Person {&lt;br&gt;
salary: number;&lt;br&gt;
}`&lt;/p&gt;

&lt;p&gt;type cannot be the same interface as mage &lt;br&gt;
type use union, primitive, and tuple, but interface only object&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
