{"id":35038,"date":"2025-11-25T05:40:58","date_gmt":"2025-11-25T02:40:58","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=35038"},"modified":"2025-11-25T05:40:58","modified_gmt":"2025-11-25T02:40:58","slug":"typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/","title":{"rendered":"TypeScript&#8217;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber"},"content":{"rendered":"<p><body><\/p>\n<h2>TypeScript&#8217;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber<\/h2>\n<h3>Giri\u015f: Mod\u00fcllerin \u00d6nemi ve Neden \u0130htiya\u00e7 Duyuldu\u011fu<\/h3>\n<p>Modern yaz\u0131l\u0131m geli\u015ftirme, giderek artan karma\u015f\u0131kl\u0131kta uygulamalar \u00fcretmeyi gerektiriyor. Bu karma\u015f\u0131kl\u0131\u011f\u0131 y\u00f6netmek, kodun okunabilirli\u011fini, bak\u0131m\u0131n\u0131 ve yeniden kullan\u0131labilirli\u011fini sa\u011flamak i\u00e7in belirli prensiplere ve ara\u00e7lara ihtiya\u00e7 duyar\u0131z. \u0130\u015fte tam da bu noktada mod\u00fcller devreye girer. TypeScript, JavaScript&#8217;in bir \u00fcst k\u00fcmesi olarak, mod\u00fcl sistemlerini daha g\u00fc\u00e7l\u00fc ve tip g\u00fcvenli bir \u015fekilde kullanmam\u0131z\u0131 sa\u011flar.<\/p>\n<p>Mod\u00fcller, kodunuzu mant\u0131ksal olarak ayr\u0131lm\u0131\u015f, ba\u011f\u0131ms\u0131z birimlere b\u00f6lmenizi sa\u011flayan mekanizmalard\u0131r. Her mod\u00fcl, kendi i\u00e7inde belirli bir i\u015flevselli\u011fi bar\u0131nd\u0131r\u0131r ve bu i\u015flevselli\u011fi di\u011fer mod\u00fcllerle payla\u015fabilir veya di\u011fer mod\u00fcllerden alabilir. Bu yakla\u015f\u0131m, yaz\u0131l\u0131m geli\u015ftirmenin temel ta\u015flar\u0131ndan biri olan &#8220;b\u00f6l ve y\u00f6net&#8221; prensibini destekler.<\/p>\n<p>Peki, mod\u00fcllere neden ihtiya\u00e7 duyar\u0131z?<\/p>\n<p>*   <strong>K\u00fcreselden Ka\u00e7\u0131nma (Avoiding Global Scope Pollution):<\/strong> Mod\u00fcllerden \u00f6nceki d\u00f6nemlerde, JavaScript dosyalar\u0131 genellikle k\u00fcresel kapsamda de\u011fi\u015fkenler ve fonksiyonlar tan\u0131mlard\u0131. Bu durum, farkl\u0131 dosyalar veya k\u00fct\u00fcphaneler aras\u0131nda isim \u00e7ak\u0131\u015fmalar\u0131na (name collision) yol a\u00e7ar ve uygulaman\u0131n beklenmedik \u015fekillerde davranmas\u0131na neden olabilirdi. Mod\u00fcller, her dosyan\u0131n kendi \u00f6zel kapsam\u0131na sahip olmas\u0131n\u0131 sa\u011flayarak bu sorunu ortadan kald\u0131r\u0131r. Bir mod\u00fcl i\u00e7inde tan\u0131mlanan her \u015fey, a\u00e7\u0131k\u00e7a d\u0131\u015far\u0131 aktar\u0131lmad\u0131\u011f\u0131 s\u00fcrece o mod\u00fcle \u00f6zel kal\u0131r.<br \/>\n*   <strong>Kodun Organizasyonu ve Yap\u0131land\u0131r\u0131lmas\u0131:<\/strong> B\u00fcy\u00fck projelerde, y\u00fczlerce veya binlerce dosya olabilir. Mod\u00fcller, bu dosyalar\u0131 mant\u0131ksal gruplara ay\u0131rarak projenin yap\u0131s\u0131n\u0131 d\u00fczenlemeye yard\u0131mc\u0131 olur. \u00d6rne\u011fin, bir <code>utils<\/code> mod\u00fcl\u00fc yard\u0131mc\u0131 fonksiyonlar\u0131, bir <code>components<\/code> mod\u00fcl\u00fc UI bile\u015fenlerini i\u00e7erebilir. Bu, geli\u015ftiricilerin belirli bir i\u015flevselli\u011fi bulmas\u0131n\u0131 ve anlamas\u0131n\u0131 kolayla\u015ft\u0131r\u0131r.<br \/>\n*   <strong>Yeniden Kullan\u0131labilirlik (Reusability):<\/strong> \u0130yi tasarlanm\u0131\u015f mod\u00fcller, farkl\u0131 projelerde veya projenin farkl\u0131 b\u00f6l\u00fcmlerinde kolayca yeniden kullan\u0131labilir. Bir mod\u00fcl\u00fc bir kez yaz\u0131p test ettikten sonra, onu defalarca i\u00e7e aktar\u0131p kullanabilirsiniz. Bu, geli\u015ftirme s\u00fcrecini h\u0131zland\u0131r\u0131r ve hatalar\u0131 azalt\u0131r.<br \/>\n*   <strong>Bak\u0131m Kolayl\u0131\u011f\u0131:<\/strong> Mod\u00fcler bir yap\u0131, bir hatan\u0131n veya de\u011fi\u015fikli\u011fin etkisini belirli bir mod\u00fclle s\u0131n\u0131rlar. Bir mod\u00fclde yap\u0131lan de\u011fi\u015fiklikler genellikle di\u011fer mod\u00fclleri do\u011frudan etkilemez, bu da bak\u0131m s\u00fcrecini daha \u00f6ng\u00f6r\u00fclebilir ve daha az riskli hale getirir. Ayr\u0131ca, mod\u00fcllerin ba\u011f\u0131ms\u0131z do\u011fas\u0131, birim testlerinin yaz\u0131lmas\u0131n\u0131 ve uygulanmas\u0131n\u0131 kolayla\u015ft\u0131r\u0131r.<br \/>\n*   <strong>Ba\u011f\u0131ml\u0131l\u0131k Y\u00f6netimi:<\/strong> Mod\u00fcller, a\u00e7\u0131k\u00e7a hangi ba\u011f\u0131ml\u0131l\u0131klara sahip olduklar\u0131n\u0131 belirtir. Bu, bir mod\u00fcl\u00fcn \u00e7al\u0131\u015fmas\u0131 i\u00e7in nelere ihtiya\u00e7 duydu\u011funu anlamay\u0131 kolayla\u015ft\u0131r\u0131r ve gereksiz kodun y\u00fcklenmesini \u00f6nler.<\/p>\n<p>TypeScript, JavaScript&#8217;in mod\u00fcl sistemlerini tam olarak destekler ve hatta tip g\u00fcvenli\u011fi ile bu sistemleri daha da geli\u015ftirir. Bu makalede, TypeScript&#8217;te mod\u00fcllerin nas\u0131l tan\u0131mland\u0131\u011f\u0131n\u0131, i\u00e7e ve d\u0131\u015fa aktar\u0131ld\u0131\u011f\u0131n\u0131, farkl\u0131 mod\u00fcl sistemlerinin ne anlama geldi\u011fini ve <code>tsconfig.json<\/code> ayarlar\u0131yla nas\u0131l yap\u0131land\u0131r\u0131ld\u0131\u011f\u0131n\u0131 detayl\u0131 bir \u015fekilde inceleyece\u011fiz.<\/p>\n<h3>Mod\u00fcllerin Temel Prensipleri: Import ve Export<\/h3>\n<p>TypeScript&#8217;te mod\u00fcl kullanman\u0131n \u00f6z\u00fc, <code>export<\/code> ve <code>import<\/code> anahtar kelimeleridir. Bu iki anahtar kelime, mod\u00fcller aras\u0131nda de\u011ferlerin, fonksiyonlar\u0131n, s\u0131n\u0131flar\u0131n veya aray\u00fczlerin nas\u0131l payla\u015f\u0131ld\u0131\u011f\u0131n\u0131 tan\u0131mlar.<\/p>\n<h4><code>export<\/code> Anahtar Kelimesi: Ne \u0130\u015fe Yarar?<\/h4>\n<p><code>export<\/code> anahtar kelimesi, bir mod\u00fcl i\u00e7indeki bir \u00f6\u011feyi (de\u011fi\u015fken, fonksiyon, s\u0131n\u0131f, tip, aray\u00fcz vb.) di\u011fer mod\u00fcller taraf\u0131ndan kullan\u0131labilir hale getirir. \u0130ki ana <code>export<\/code> t\u00fcr\u00fc vard\u0131r: adland\u0131r\u0131lm\u0131\u015f (named) ve varsay\u0131lan (default).<\/p>\n<h5>Adland\u0131r\u0131lm\u0131\u015f Export (Named Exports)<\/h5>\n<p>Adland\u0131r\u0131lm\u0131\u015f exportlar, bir mod\u00fclden birden fazla \u00f6\u011feyi d\u0131\u015far\u0131 aktarmak istedi\u011finizde kullan\u0131l\u0131r. Her \u00f6\u011fe, kendi orijinal ad\u0131yla d\u0131\u015far\u0131 aktar\u0131l\u0131r ve i\u00e7e aktar\u0131l\u0131r.<\/p>\n<pre><code class=\"language-typescript\">\/\/ math.ts\nexport const PI = 3.14159;\n\nexport function sum(a: number, b: number): number {\n    return a + b;\n}\n\nexport class Calculator {\n    add(x: number, y: number): number {\n        return x + y;\n    }\n}\n\ninterface Point {\n    x: number;\n    y: number;\n}\nexport type Coords = Point; \/\/ Type'\u0131 d\u0131\u015fa aktarma\n\n\/\/ D\u0131\u015fa aktarma listesi ile de yap\u0131labilir:\n\/\/ const PI = 3.14159;\n\/\/ function sum(a: number, b: number): number { return a + b; }\n\/\/ export { PI, sum };<\/code><\/pre>\n<h5>Varsay\u0131lan Export (Default Exports)<\/h5>\n<p>Bir mod\u00fcl\u00fcn genellikle &#8220;ana&#8221; i\u015flevini temsil eden tek bir \u00f6\u011feyi d\u0131\u015far\u0131 aktarmak istedi\u011finizde varsay\u0131lan export kullan\u0131l\u0131r. Bir mod\u00fcl ba\u015f\u0131na yaln\u0131zca bir varsay\u0131lan export olabilir. \u0130\u00e7e aktar\u0131l\u0131rken, bu \u00f6\u011feye herhangi bir isim verebilirsiniz.<\/p>\n<pre><code class=\"language-typescript\">\/\/ greeter.ts\nclass Greeter {\n    greet(name: string): string {\n        return <code>Hello, ${name}!<\/code>;\n    }\n}\n\nexport default Greeter; \/\/ Sadece bir varsay\u0131lan export olabilir\n\n\/\/ Veya bir fonksiyonu varsay\u0131lan olarak d\u0131\u015fa aktarma:\n\/\/ export default function sayHello(name: string): string {\n\/\/     return <code>Hello, ${name}!<\/code>;\n\/\/ }\n\n\/\/ Veya bir de\u011feri:\n\/\/ const myValue = 42;\n\/\/ export default myValue;<\/code><\/pre>\n<h4><code>import<\/code> Anahtar Kelimesi: Nas\u0131l Kullan\u0131l\u0131r?<\/h4>\n<p><code>import<\/code> anahtar kelimesi, ba\u015fka bir mod\u00fcl taraf\u0131ndan d\u0131\u015fa aktar\u0131lm\u0131\u015f \u00f6\u011feleri mevcut mod\u00fcl\u00fcn\u00fcze dahil etmek i\u00e7in kullan\u0131l\u0131r.<\/p>\n<h5>Adland\u0131r\u0131lm\u0131\u015f Import (Named Imports)<\/h5>\n<p>Adland\u0131r\u0131lm\u0131\u015f exportlar\u0131 i\u00e7e aktar\u0131rken, s\u00fcsl\u00fc parantezler <code>{}<\/code> kullanarak ve \u00f6\u011felerin orijinal adlar\u0131n\u0131 belirterek i\u00e7e aktar\u0131rs\u0131n\u0131z.<\/p>\n<pre><code class=\"language-typescript\">\/\/ app.ts\nimport { PI, sum, Calculator, Coords } from '.\/math'; \/\/ '.\/math' dosya yolunu belirtir\n\nconsole.log(PI); \/\/ 3.14159\nconsole.log(sum(5, 3)); \/\/ 8\n\nconst calc = new Calculator();\nconsole.log(calc.add(10, 20)); \/\/ 30\n\nconst myCoords: Coords = { x: 10, y: 20 };\nconsole.log(myCoords);\n\n\/\/ \u0130\u00e7e aktar\u0131lan \u00f6\u011felere farkl\u0131 bir isim vermek isterseniz <code>as<\/code> anahtar kelimesini kullanabilirsiniz:\nimport { PI as MyPi, sum as addNumbers } from '.\/math';\nconsole.log(MyPi);\nconsole.log(addNumbers(1, 2));<\/code><\/pre>\n<h5>Varsay\u0131lan Import (Default Imports)<\/h5>\n<p>Varsay\u0131lan exportlar\u0131 i\u00e7e aktar\u0131rken, s\u00fcsl\u00fc parantez kullanmadan, do\u011frudan i\u00e7e aktarmak istedi\u011finiz \u00f6\u011feye bir isim verirsiniz.<\/p>\n<pre><code class=\"language-typescript\">\/\/ app.ts\nimport MyGreeter from '.\/greeter'; \/\/ 'Greeter' s\u0131n\u0131f\u0131 'MyGreeter' ad\u0131yla i\u00e7e aktar\u0131ld\u0131\n\nconst greeter = new MyGreeter();\nconsole.log(greeter.greet('TypeScript User')); \/\/ Hello, TypeScript User!<\/code><\/pre>\n<p>Varsay\u0131lan ve adland\u0131r\u0131lm\u0131\u015f exportlar\u0131 ayn\u0131 anda i\u00e7e aktarabilirsiniz:<\/p>\n<pre><code class=\"language-typescript\">\/\/ mixed.ts\nexport const SOME_CONSTANT = 100;\nexport default class MyClass { \/<em> ... <\/em>\/ }\n\n\/\/ app.ts\nimport MyClass, { SOME_CONSTANT } from '.\/mixed';\nconsole.log(SOME_CONSTANT); \/\/ 100\nconst instance = new MyClass();<\/code><\/pre>\n<h5>T\u00fcm\u00fcn\u00fc Import Etme (Namespace Import)<\/h5>\n<p>Bir mod\u00fcl\u00fcn t\u00fcm adland\u0131r\u0131lm\u0131\u015f exportlar\u0131n\u0131 tek bir nesne alt\u0131nda i\u00e7e aktarmak isterseniz, <code>* as<\/code> s\u00f6zdizimini kullanabilirsiniz.<\/p>\n<pre><code class=\"language-typescript\">\/\/ app.ts\nimport * as MathUtils from '.\/math';\n\nconsole.log(MathUtils.PI);\nconsole.log(MathUtils.sum(7, 8));\nconst calc = new MathUtils.Calculator();\nconsole.log(calc.add(1, 2));<\/code><\/pre>\n<h5>Yeniden Export Etme (Re-exporting)<\/h5>\n<p>Bazen bir mod\u00fcl\u00fcn d\u0131\u015fa aktard\u0131\u011f\u0131 \u00f6\u011feleri ba\u015fka bir mod\u00fcl arac\u0131l\u0131\u011f\u0131yla yeniden d\u0131\u015fa aktarmak isteyebilirsiniz. Bu, API y\u00fczeyini d\u00fczenlemek veya daha y\u00fcksek seviyeli bir mod\u00fcl olu\u015fturmak i\u00e7in kullan\u0131\u015fl\u0131d\u0131r.<\/p>\n<pre><code class=\"language-typescript\">\/\/ components\/button.ts\nexport class Button { \/<em> ... <\/em>\/ }\n\n\/\/ components\/input.ts\nexport class Input { \/<em> ... <\/em>\/ }\n\n\/\/ components\/index.ts (bir \"barrel file\" veya toplu export dosyas\u0131)\nexport * from '.\/button'; \/\/ button.ts'deki t\u00fcm adland\u0131r\u0131lm\u0131\u015f exportlar\u0131 yeniden d\u0131\u015fa aktar\nexport * from '.\/input';  \/\/ input.ts'deki t\u00fcm adland\u0131r\u0131lm\u0131\u015f exportlar\u0131 yeniden d\u0131\u015fa akt\n\n\/\/ app.ts\nimport { Button, Input } from '.\/components'; \/\/ \u015eimdi do\u011frudan 'components' mod\u00fcl\u00fcnden alabiliriz<\/code><\/pre>\n<p>Varsay\u0131lan exportlar\u0131 yeniden d\u0131\u015fa aktarmak i\u00e7in biraz farkl\u0131 bir s\u00f6zdizimi kullan\u0131l\u0131r:<\/p>\n<pre><code class=\"language-typescript\">\/\/ moduleA.ts\nexport default class A {}\n\n\/\/ moduleB.ts\nexport { default as ClassA } from '.\/moduleA'; \/\/ default'u ClassA olarak yeniden d\u0131\u015fa aktar\n\n\/\/ app.ts\nimport { ClassA } from '.\/moduleB';\nconst a = new ClassA();<\/code><\/pre>\n<h5>Yan Etkiler \u0130\u00e7in Import Etme (Side-effect Imports)<\/h5>\n<p>Baz\u0131 mod\u00fcllerin, sadece i\u00e7e aktar\u0131ld\u0131klar\u0131nda \u00e7al\u0131\u015fan global konfig\u00fcrasyonlar veya di\u011fer yan etkileri olabilir. Bu t\u00fcr mod\u00fclleri i\u00e7e aktarmak i\u00e7in s\u00fcsl\u00fc parantez veya isim belirtmeden sadece <code>import<\/code> anahtar kelimesini kullan\u0131rs\u0131n\u0131z.<\/p>\n<pre><code class=\"language-typescript\">\/\/ polyfills.ts (\u00f6rne\u011fin, belirli taray\u0131c\u0131 API'lar\u0131n\u0131 ekler)\nimport 'some-polyfill-library';\n\n\/\/ app.ts\nimport '.\/polyfills'; \/\/ Sadece polyfills.ts dosyas\u0131n\u0131n \u00e7al\u0131\u015fmas\u0131n\u0131 sa\u011flar, herhangi bir de\u011fer i\u00e7e aktarmaz.<\/code><\/pre>\n<h3>Mod\u00fcl Sistemleri (Module Systems): Tarih\u00e7e ve TypeScript Deste\u011fi<\/h3>\n<p>JavaScript&#8217;in ba\u015flang\u0131c\u0131ndan itibaren, mod\u00fcl sistemleri ekosistemde farkl\u0131 \u015fekillerde geli\u015fti. TypeScript, bu farkl\u0131 sistemleri destekleyerek geli\u015ftiricilere esneklik sunar. En yayg\u0131n mod\u00fcl sistemleri CommonJS ve ES Mod\u00fclleri&#8217;dir.<\/p>\n<h4>CommonJS (CJS)<\/h4>\n<p>CommonJS, \u00f6zellikle sunucu taraf\u0131 JavaScript (Node.js) i\u00e7in geli\u015ftirilmi\u015f bir mod\u00fcl sistemidir. Senkron bir y\u00fckleme modeline sahiptir, yani bir mod\u00fcl i\u00e7e aktar\u0131ld\u0131\u011f\u0131nda, o mod\u00fcl\u00fcn kodu tamamen y\u00fcklenene ve \u00e7al\u0131\u015ft\u0131r\u0131lana kadar program\u0131n y\u00fcr\u00fct\u00fclmesi durur.<\/p>\n<h5>Node.js Ortam\u0131nda Kullan\u0131m\u0131<\/h5>\n<p>Node.js&#8217;te CommonJS, <code>require()<\/code> fonksiyonu ile mod\u00fclleri i\u00e7e aktar\u0131r ve <code>module.exports<\/code> veya <code>exports<\/code> nesnesi ile mod\u00fclleri d\u0131\u015fa aktar\u0131r.<\/p>\n<pre><code class=\"language-javascript\">\/\/ myModule.js (CommonJS)\nconst myVariable = 123;\nfunction myFunction() { return 'Hello from CJS'; }\n\nmodule.exports = {\n    myVariable,\n    myFunction\n};\n\n\/\/ app.js (CommonJS)\nconst { myVariable, myFunction } = require('.\/myModule');\nconsole.log(myVariable); \/\/ 123\nconsole.log(myFunction()); \/\/ Hello from CJS<\/code><\/pre>\n<h5>TypeScript&#8217;te CommonJS Yap\u0131land\u0131rmas\u0131 (<code>tsconfig.json<\/code>)<\/h5>\n<p>TypeScript, CommonJS s\u00f6zdizimini kullanarak yaz\u0131lm\u0131\u015f kodlar\u0131 derleyebilir ve modern ES mod\u00fcl s\u00f6zdizimini CommonJS&#8217;e d\u00f6n\u00fc\u015ft\u00fcrebilir. Bunu yapmak i\u00e7in <code>tsconfig.json<\/code> dosyas\u0131nda <code>module<\/code> derleyici se\u00e7ene\u011fini <code>commonjs<\/code> olarak ayarlaman\u0131z gerekir.<\/p>\n<pre><code class=\"language-json\">\/\/ tsconfig.json\n{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\", \/\/ CommonJS mod\u00fcl sistemini kullan\n    \"target\": \"es2016\",   \/\/ Hedef JavaScript s\u00fcr\u00fcm\u00fc\n    \"esModuleInterop\": true, \/\/ ES Mod\u00fclleri ile CommonJS aras\u0131ndaki uyumlulu\u011fu art\u0131r\u0131r\n    \"strict\": true,\n    \"outDir\": \".\/dist\"\n  },\n  \"include\": [\n    \"src\/<em><\/em>\/*\"\n  ]\n}<\/code><\/pre>\n<p><code>esModuleInterop: true<\/code> se\u00e7ene\u011fi \u00f6nemlidir \u00e7\u00fcnk\u00fc ES Mod\u00fclleri&#8217;nin varsay\u0131lan importlar\u0131 ile CommonJS&#8217;in <code>module.exports<\/code> yap\u0131s\u0131 aras\u0131nda uyumluluk sa\u011flar. Bu olmadan, CommonJS mod\u00fcllerini ES mod\u00fcl\u00fc s\u00f6zdizimiyle i\u00e7e aktar\u0131rken sorunlar ya\u015fayabilirsiniz (\u00f6rne\u011fin, <code>import * as React from 'react'<\/code> yerine <code>import React from 'react'<\/code> kullanamama).<\/p>\n<h4>ES Mod\u00fclleri (ESM \/ ECMAScript Modules)<\/h4>\n<p>ES Mod\u00fclleri, ECMAScript 2015 (ES6) ile JavaScript&#8217;e resmi olarak eklenen standart mod\u00fcl sistemidir. Asenkron bir y\u00fckleme modeline sahiptir ve hem taray\u0131c\u0131larda hem de Node.js gibi sunucu ortamlar\u0131nda \u00e7al\u0131\u015facak \u015fekilde tasarlanm\u0131\u015ft\u0131r. <code>import<\/code> ve <code>export<\/code> anahtar kelimeleri bu sistemin bir par\u00e7as\u0131d\u0131r.<\/p>\n<h5>Modern Web Geli\u015ftirmede Yeri<\/h5>\n<p>Modern web taray\u0131c\u0131lar\u0131, ES Mod\u00fcllerini do\u011frudan destekler. Bir <code><script><\/code> etiketine <code>type=\"module\"<\/code> \u00f6zniteli\u011fi ekleyerek taray\u0131c\u0131da ES Mod\u00fcllerini kullanabilirsiniz.<\/p>\n<pre><code class=\"language-html\"><!-- index.html -->\n<script type=\"module\" src=\".\/app.js\"><\/script><\/code><\/pre>\n<pre><code class=\"language-javascript\">\/\/ app.js\nimport { sum } from '.\/math.js'; \/\/ Taray\u0131c\u0131da dosya uzant\u0131s\u0131 \u00f6nemlidir\nconsole.log(sum(1, 2));<\/code><\/pre>\n<h5>Taray\u0131c\u0131 Deste\u011fi<\/h5>\n<p>G\u00fcncel t\u00fcm modern taray\u0131c\u0131lar ES Mod\u00fcllerini desteklemektedir. Ancak, eski taray\u0131c\u0131lar i\u00e7in bir d\u00f6n\u00fc\u015ft\u00fcrme (transpilation) i\u015flemi veya polyfill gerekebilir.<\/p>\n<h5>Node.js'te ESM Kullan\u0131m\u0131<\/h5>\n<p>Node.js, v12 ve sonraki s\u00fcr\u00fcmlerden itibaren ES Mod\u00fcllerini resmi olarak desteklemektedir. Node.js'te ESM kullanman\u0131n iki ana yolu vard\u0131r:<br \/>\n1.  <strong>.mjs uzant\u0131s\u0131:<\/strong> Dosyalar\u0131n\u0131z\u0131 <code>.mjs<\/code> uzant\u0131s\u0131yla kaydetmek, Node.js'e o dosyan\u0131n bir ES Mod\u00fcl\u00fc oldu\u011funu bildirir.<br \/>\n2.  <strong><code>package.json<\/code>'da <code>type: \"module\"<\/code>:<\/strong> Projenizin <code>package.json<\/code> dosyas\u0131na <code>\"type\": \"module\"<\/code> eklemek, <code>.js<\/code> uzant\u0131l\u0131 t\u00fcm dosyalar\u0131n varsay\u0131lan olarak ES Mod\u00fcl\u00fc olarak ele al\u0131nmas\u0131n\u0131 sa\u011flar.<\/p>\n<pre><code class=\"language-json\">\/\/ package.json\n{\n  \"name\": \"my-esm-project\",\n  \"version\": \"1.0.0\",\n  \"type\": \"module\", \/\/ Bu, .js dosyalar\u0131n\u0131n ESM olarak yorumlanmas\u0131n\u0131 sa\u011flar\n  \"main\": \"dist\/index.js\",\n  \"scripts\": {\n    \"start\": \"node dist\/index.js\"\n  }\n}<\/code><\/pre>\n<h5>TypeScript'te ES Mod\u00fclleri Yap\u0131land\u0131rmas\u0131 (<code>tsconfig.json<\/code>)<\/h5>\n<p>TypeScript kodunuzu ES Mod\u00fcllerini kullanacak \u015fekilde derlemek i\u00e7in <code>module<\/code> se\u00e7ene\u011fini <code>esnext<\/code>, <code>es2020<\/code>, <code>es2022<\/code>, <code>node16<\/code> veya <code>nodenext<\/code> gibi bir de\u011fere ayarlayabilirsiniz. <code>esnext<\/code> genellikle en g\u00fcncel ES mod\u00fcl \u00f6zelliklerini kullan\u0131r.<\/p>\n<pre><code class=\"language-json\">\/\/ tsconfig.json\n{\n  \"compilerOptions\": {\n    \"module\": \"esnext\", \/\/ ES Mod\u00fcllerini kullan (en g\u00fcncel)\n    \"target\": \"es2020\",  \/\/ Hedef JavaScript s\u00fcr\u00fcm\u00fc\n    \"strict\": true,\n    \"outDir\": \".\/dist\",\n    \"moduleResolution\": \"node\" \/\/ veya \"nodenext\"\n  },\n  \"include\": [\n    \"src\/<em><\/em>\/*\"\n  ]\n}<\/code><\/pre>\n<h4>AMD (Asynchronous Module Definition) - K\u0131sa Bahis<\/h4>\n<p>AMD, taray\u0131c\u0131 ortam\u0131nda asenkron mod\u00fcl y\u00fcklemesi i\u00e7in tasarlanm\u0131\u015f bir mod\u00fcl sistemidir. <code>require.js<\/code> gibi k\u00fct\u00fcphanelerle pop\u00fclerlik kazanm\u0131\u015ft\u0131r. G\u00fcn\u00fcm\u00fczde ES Mod\u00fclleri'nin yayg\u0131nla\u015fmas\u0131yla kullan\u0131m\u0131 azalm\u0131\u015ft\u0131r. TypeScript, <code>module: \"amd\"<\/code> se\u00e7ene\u011fi ile AMD'yi destekler.<\/p>\n<h4>UMD (Universal Module Definition) - K\u0131sa Bahis<\/h4>\n<p>UMD, CommonJS, AMD ve k\u00fcresel de\u011fi\u015fkenler gibi farkl\u0131 mod\u00fcl sistemlerinde \u00e7al\u0131\u015fabilen, \"evrensel\" bir mod\u00fcl tan\u0131mlama \u015feklidir. K\u00fct\u00fcphane yazarlar\u0131 taraf\u0131ndan, k\u00fct\u00fcphanelerinin m\u00fcmk\u00fcn oldu\u011funca \u00e7ok ortamda \u00e7al\u0131\u015fmas\u0131n\u0131 sa\u011flamak i\u00e7in kullan\u0131lm\u0131\u015ft\u0131r. TypeScript, <code>module: \"umd\"<\/code> se\u00e7ene\u011fi ile UMD'yi destekler.<\/p>\n<h4>Sistem Se\u00e7imi ve <code>tsconfig.json<\/code>'daki <code>module<\/code> Ayar\u0131<\/h4>\n<p>Hangi mod\u00fcl sistemini se\u00e7ece\u011finiz projenizin hedefine ve ortam\u0131na ba\u011fl\u0131d\u0131r:<\/p>\n<p>*   <strong>Node.js uygulamalar\u0131 i\u00e7in:<\/strong> <code>commonjs<\/code> veya <code>node16<\/code>\/<code>nodenext<\/code> (ESM kullanmak istiyorsan\u0131z).<br \/>\n*   <strong>Taray\u0131c\u0131 uygulamalar\u0131 i\u00e7in:<\/strong> <code>esnext<\/code> veya <code>es2020<\/code> gibi modern bir ES mod\u00fcl de\u011feri. Ard\u0131ndan bir paketleyici (webpack, Rollup, Vite) kullanarak taray\u0131c\u0131 uyumlu hale getirebilirsiniz.<br \/>\n*   <strong>K\u00fct\u00fcphane yazarlar\u0131 i\u00e7in:<\/strong> Genellikle <code>esm<\/code> (ES Mod\u00fclleri) ve <code>cjs<\/code> (CommonJS) \u00e7\u0131kt\u0131lar\u0131 birlikte sunulur, b\u00f6ylece k\u00fct\u00fcphane farkl\u0131 ortamlarda kullan\u0131labilir.<\/p>\n<p><code>tsconfig.json<\/code>'daki <code>module<\/code> ayar\u0131, TypeScript'in <code>import<\/code> ve <code>export<\/code> ifadelerini hangi JavaScript mod\u00fcl \u00e7\u0131kt\u0131s\u0131na d\u00f6n\u00fc\u015ft\u00fcrece\u011fini belirler.<\/p>\n<h3>TypeScript'te Mod\u00fcl \u00c7\u00f6z\u00fcmlemesi (Module Resolution): <code>moduleResolution<\/code><\/h3>\n<p>Mod\u00fcl \u00e7\u00f6z\u00fcmlemesi, <code>import<\/code> ifadelerinde belirtilen mod\u00fcl yollar\u0131n\u0131n ger\u00e7ek dosya sistemindeki dosyalara nas\u0131l d\u00f6n\u00fc\u015ft\u00fcr\u00fcld\u00fc\u011f\u00fcn\u00fc belirleyen s\u00fcre\u00e7tir. TypeScript, bu s\u00fcre\u00e7 i\u00e7in farkl\u0131 stratejiler sunar ve <code>tsconfig.json<\/code>'daki <code>moduleResolution<\/code> se\u00e7ene\u011fi ile bu stratejiyi yap\u0131land\u0131rabilirsiniz.<\/p>\n<h4>Klasik (Classic) \u00c7\u00f6z\u00fcmleme<\/h4>\n<p>Bu, TypeScript'in ilk mod\u00fcl \u00e7\u00f6z\u00fcmleme stratejisidir ve genellikle eski taray\u0131c\u0131 tabanl\u0131 projeler i\u00e7in kullan\u0131l\u0131r. Ba\u011f\u0131l yollar\u0131 ve <code>baseUrl<\/code>'\u0131 temel al\u0131r. Bir <code>import 'moduleA'<\/code> ifadesi i\u00e7in, TypeScript \u00f6nce <code>moduleA.ts<\/code>, <code>moduleA.d.ts<\/code>, <code>moduleA.js<\/code> gibi dosyalar\u0131 mevcut dizinde arar, sonra \u00fcst dizinlere \u00e7\u0131karak bu aramay\u0131 tekrarlar. Bu mod\u00fcl \u00e7\u00f6z\u00fcn\u00fcrl\u00fck stratejisi, <code>node_modules<\/code> dizinindeki paketleri do\u011frudan aramaz.<\/p>\n<h4>Node \u00c7\u00f6z\u00fcmlemesi<\/h4>\n<p>Node.js'in mod\u00fcl \u00e7\u00f6z\u00fcmleme algoritmas\u0131n\u0131 taklit eder. Bu, Node.js uygulamalar\u0131 veya Node.js ortam\u0131nda \u00e7al\u0131\u015facak taray\u0131c\u0131 uygulamalar\u0131 i\u00e7in en yayg\u0131n ve \u00f6nerilen stratejidir.<br \/>\nBir <code>import 'moduleA'<\/code> ifadesi i\u00e7in:<br \/>\n1.  <strong>Ba\u011f\u0131l yol (relative path) ise:<\/strong> <code>.\/<\/code>, <code>..\/<\/code> gibi yollarla belirtilmi\u015fse, do\u011frudan o yoldaki dosyay\u0131 arar.<br \/>\n2.  <strong>Mod\u00fcl ad\u0131 ise (Node.js paketleri i\u00e7in):<\/strong><br \/>\n    *   <code>node_modules<\/code> dizininde <code>moduleA<\/code> adl\u0131 bir klas\u00f6r arar.<br \/>\n    *   Bu klas\u00f6rde <code>package.json<\/code> dosyas\u0131n\u0131 arar ve <code>main<\/code> veya <code>exports<\/code> alan\u0131na bakar.<br \/>\n    *   E\u011fer <code>package.json<\/code> yoksa veya <code>main<\/code> belirtilmemi\u015fse, <code>index.js<\/code>, <code>index.ts<\/code>, <code>index.d.ts<\/code> gibi varsay\u0131lan dosyalar\u0131 arar.<br \/>\n    *   Bulamazsa, \u00fcst dizinlere \u00e7\u0131karak <code>node_modules<\/code> i\u00e7inde aramaya devam eder.<\/p>\n<pre><code class=\"language-json\">\/\/ tsconfig.json\n{\n  \"compilerOptions\": {\n    \"moduleResolution\": \"node\", \/\/ Node.js mod\u00fcl \u00e7\u00f6z\u00fcmlemesini kullan\n    \"module\": \"commonjs\",     \/\/ veya \"esnext\"\n    \"target\": \"es2016\"\n  }\n}<\/code><\/pre>\n<h4>Node16 \/ Nodenext \u00c7\u00f6z\u00fcmlemesi<\/h4>\n<p>TypeScript 4.7 ile tan\u0131t\u0131lan bu yeni stratejiler, Node.js'in ES Mod\u00fclleri i\u00e7in uygulad\u0131\u011f\u0131 daha kat\u0131 \u00e7\u00f6z\u00fcmleme kurallar\u0131n\u0131 yans\u0131t\u0131r. \u00d6zellikle <code>package.json<\/code>'daki <code>type<\/code> alan\u0131 (<code>\"type\": \"module\"<\/code>) ve dosya uzant\u0131lar\u0131 (<code>.mjs<\/code>, <code>.cjs<\/code>) gibi fakt\u00f6rleri dikkate al\u0131r. Bu stratejiler, ESM'nin Node.js'teki kesin davran\u0131\u015f\u0131n\u0131 yans\u0131tmak i\u00e7in tasarlanm\u0131\u015ft\u0131r ve <code>import<\/code> ifadelerinde dosya uzant\u0131lar\u0131n\u0131n belirtilmesini gerektirebilir.<\/p>\n<pre><code class=\"language-json\">\/\/ tsconfig.json\n{\n  \"compilerOptions\": {\n    \"moduleResolution\": \"nodenext\", \/\/ Node.js'in ESM \u00e7\u00f6z\u00fcmlemesini kullan\n    \"module\": \"nodenext\",          \/\/ module da \"nodenext\" olmal\u0131\n    \"target\": \"es2022\"\n  }\n}<\/code><\/pre>\n<h4><code>baseUrl<\/code> ve <code>paths<\/code> Kullan\u0131m\u0131<\/h4>\n<p>B\u00fcy\u00fck projelerde, ba\u011f\u0131l yollar (<code>..\/..\/..\/components\/button<\/code>) karma\u015f\u0131k ve okunaks\u0131z hale gelebilir. <code>baseUrl<\/code> ve <code>paths<\/code> se\u00e7enekleri, mutlak import yollar\u0131n\u0131 daha d\u00fczenli hale getirmek i\u00e7in kullan\u0131l\u0131r.<\/p>\n<p>*   <strong><code>baseUrl<\/code>:<\/strong> Mod\u00fcl \u00e7\u00f6z\u00fcmlemesinin ba\u015flang\u0131\u00e7 noktas\u0131 olarak kullan\u0131lacak temel dizini belirtir.<\/p>\n<pre><code class=\"language-json\">\/\/ tsconfig.json\n    {\n      \"compilerOptions\": {\n        \"baseUrl\": \".\/src\", \/\/ T\u00fcm mod\u00fcl importlar\u0131 'src' dizininden ba\u015flayacak\n        \"moduleResolution\": \"node\"\n      }\n    }<\/code><\/pre>\n<p>    \u015eimdi <code>src\/components\/button.ts<\/code> dosyas\u0131n\u0131 <code>import { Button } from 'components\/button';<\/code> \u015feklinde i\u00e7e aktarabilirsiniz.<\/p>\n<p>*   <strong><code>paths<\/code>:<\/strong> Mod\u00fcl yollar\u0131 i\u00e7in \u00f6zel e\u015fle\u015fmeler tan\u0131mlaman\u0131za olanak tan\u0131r. Bu, takma adlar (aliases) olu\u015fturmak i\u00e7in harikad\u0131r.<\/p>\n<pre><code class=\"language-json\">\/\/ tsconfig.json\n    {\n      \"compilerOptions\": {\n        \"baseUrl\": \".\", \/\/ paths'i kullanmak i\u00e7in baseUrl gereklidir\n        \"paths\": {\n          \"@components\/<em>\": [\"src\/components\/<\/em>\"],\n          \"@utils\/<em>\": [\"src\/utils\/<\/em>\"]\n        },\n        \"moduleResolution\": \"node\"\n      }\n    }<\/code><\/pre>\n<p>    \u015eimdi <code>src\/components\/button.ts<\/code> dosyas\u0131n\u0131 <code>import { Button } from '@components\/button';<\/code> \u015feklinde i\u00e7e aktarabilirsiniz. Bu, kodun daha temiz ve ta\u015f\u0131nabilir olmas\u0131n\u0131 sa\u011flar.<\/p>\n<h4>Dosya Uzant\u0131lar\u0131 ve Mod\u00fcl \u00c7\u00f6z\u00fcmlemesi<\/h4>\n<p>ES Mod\u00fclleri'nin Node.js'te ve taray\u0131c\u0131larda kullan\u0131lmas\u0131yla birlikte, <code>import<\/code> ifadelerinde dosya uzant\u0131lar\u0131n\u0131n belirtilmesi (\u00f6rne\u011fin, <code>import { foo } from '.\/foo.js';<\/code>) \u00f6nem kazanm\u0131\u015ft\u0131r. TypeScript, varsay\u0131lan olarak bu uzant\u0131lar\u0131 otomatik olarak eklemez. <code>moduleResolution: \"nodenext\"<\/code> veya <code>module: \"nodenext\"<\/code> gibi ayarlar, bu davran\u0131\u015fa daha yak\u0131ndan uymay\u0131 hedefler. Geli\u015ftiricilerin bu konuda dikkatli olmas\u0131 ve derleme \u00e7\u0131kt\u0131lar\u0131n\u0131 kontrol etmesi \u00f6nemlidir.<\/p>\n<h3>Mod\u00fcllerle \u00c7al\u0131\u015f\u0131rken Geli\u015fmi\u015f Konular<\/h3>\n<p>TypeScript'te mod\u00fcller sadece temel <code>import\/export<\/code> yap\u0131lar\u0131yla s\u0131n\u0131rl\u0131 de\u011fildir. Daha karma\u015f\u0131k senaryolar\u0131 y\u00f6netmek i\u00e7in geli\u015fmi\u015f \u00f6zellikler de mevcuttur.<\/p>\n<h4>Dinamik Importlar (<code>import()<\/code>)<\/h4>\n<p>ES2020 ile birlikte gelen dinamik importlar, bir mod\u00fcl\u00fc ko\u015fullu olarak veya iste\u011fe ba\u011fl\u0131 olarak y\u00fcklemenizi sa\u011flar. Bu, statik <code>import<\/code> ifadelerinden farkl\u0131 olarak bir Promise d\u00f6nd\u00fcr\u00fcr ve mod\u00fcl\u00fcn i\u00e7eri\u011fine asenkron olarak eri\u015fmenizi sa\u011flar.<\/p>\n<pre><code class=\"language-typescript\">\/\/ button-module.ts\nexport function createButton(text: string) {\n    const btn = document.createElement('button');\n    btn.textContent = text;\n    return btn;\n}\n\n\/\/ app.ts\nasync function loadButtonModule() {\n    if (document.getElementById('lazy-load-area')) {\n        \/\/ Mod\u00fcl\u00fc sadece belirli bir ko\u015ful kar\u015f\u0131land\u0131\u011f\u0131nda y\u00fckle\n        const { createButton } = await import('.\/button-module');\n        const button = createButton('Dinamik Buton');\n        document.getElementById('lazy-load-area')?.appendChild(button);\n    }\n}\n\n\/\/ Bir kullan\u0131c\u0131 etkile\u015fimi sonras\u0131 \u00e7a\u011fr\u0131labilir\ndocument.getElementById('load-btn')?.addEventListener('click', loadButtonModule);<\/code><\/pre>\n<h5>Code Splitting<\/h5>\n<p>Dinamik importlar, modern web uygulamalar\u0131nda \"code splitting\" (kod b\u00f6lme) i\u00e7in temel bir ara\u00e7t\u0131r. Bir uygulaman\u0131n ba\u015flang\u0131\u00e7 y\u00fckleme boyutunu azaltarak performans\u0131 art\u0131r\u0131r. Kullan\u0131c\u0131 belirli bir rotaya gitti\u011finde veya belirli bir etkile\u015fimde bulundu\u011funda ilgili kod par\u00e7ac\u0131klar\u0131n\u0131 y\u00fckleyerek, sadece ihtiya\u00e7 duyulan kodun indirilmesini sa\u011flar.<\/p>\n<h5>Ko\u015fullu Y\u00fckleme<\/h5>\n<p>Bir mod\u00fcl\u00fc belirli bir ko\u015fula (\u00f6rne\u011fin, kullan\u0131c\u0131n\u0131n rol\u00fc, taray\u0131c\u0131 \u00f6zellikleri) ba\u011fl\u0131 olarak y\u00fcklemek istedi\u011finizde dinamik importlar \u00e7ok kullan\u0131\u015fl\u0131d\u0131r.<\/p>\n<h4>Mod\u00fcl Ortam Bildirimleri (Module Augmentation \/ Declaration Merging)<\/h4>\n<p>TypeScript, mevcut mod\u00fcllere yeni \u00f6zellikler eklemenize veya global kapsamda bildirimler yapman\u0131za olanak tan\u0131yan bir dizi bildirim mekanizmas\u0131na sahiptir. Bu, \u00f6zellikle \u00fc\u00e7\u00fcnc\u00fc taraf k\u00fct\u00fcphaneler i\u00e7in tip tan\u0131mlamalar\u0131 eklerken veya mevcut mod\u00fcllerin tiplerini geni\u015fletirken kullan\u0131\u015fl\u0131d\u0131r.<\/p>\n<h5>Global Bildirimler<\/h5>\n<p>E\u011fer bir k\u00fct\u00fcphane global kapsamda de\u011fi\u015fkenler veya fonksiyonlar tan\u0131ml\u0131yorsa (\u00f6rne\u011fin, <code>$<\/code> veya <code>_<\/code> gibi), bunlar\u0131 TypeScript'e tan\u0131tmak i\u00e7in global bildirimler kullanabilirsiniz.<\/p>\n<pre><code class=\"language-typescript\">\/\/ global.d.ts\ndeclare global {\n    interface Window {\n        myGlobalVariable: string;\n    }\n    function myGlobalFunction(arg: string): void;\n}\n\/\/ Art\u0131k 'window.myGlobalVariable' ve 'myGlobalFunction' tip g\u00fcvenli bir \u015fekilde kullan\u0131labilir.<\/code><\/pre>\n<h5>Mod\u00fcl Bildirimleri (<code>declare module<\/code>)<\/h5>\n<p>Mevcut bir mod\u00fcl\u00fcn (kendi yazd\u0131\u011f\u0131n\u0131z veya bir npm paketinden gelen) tip tan\u0131mlamalar\u0131n\u0131 geni\u015fletmek istedi\u011finizde <code>declare module<\/code> s\u00f6zdizimini kullan\u0131rs\u0131n\u0131z. Bu, \"declaration merging\" (bildirim birle\u015ftirme) olarak da bilinir.<\/p>\n<pre><code class=\"language-typescript\">\/\/ types\/my-library.d.ts\ndeclare module 'my-library' {\n    \/\/ Mevcut 'my-library' mod\u00fcl\u00fcne yeni bir aray\u00fcz ekle\n    export interface LibraryOptions {\n        customOption?: boolean;\n    }\n\n    \/\/ Mevcut bir s\u0131n\u0131f veya fonksiyona yeni bir metot\/\u00f6zellik ekle\n    interface MyClass {\n        newMethod(): void;\n    }\n}\n\n\/\/ app.ts\nimport { MyClass, LibraryOptions } from 'my-library';\n\nconst opts: LibraryOptions = { customOption: true }; \/\/ Art\u0131k bu tip mevcut\nconst instance = new MyClass();\ninstance.newMethod(); \/\/ Art\u0131k bu metot mevcut<\/code><\/pre>\n<p>Bu, \u00f6zellikle bir k\u00fct\u00fcphanenin tip tan\u0131mlamalar\u0131 eksik oldu\u011funda veya kendi uygulamalar\u0131n\u0131z i\u00e7in \u00f6zelle\u015ftirmeler yapmak istedi\u011finizde \u00e7ok g\u00fc\u00e7l\u00fc bir \u00f6zelliktir.<\/p>\n<h4>TypeScript Ad Alanlar\u0131 (Namespaces) vs. Mod\u00fcller<\/h4>\n<p>TypeScript'in ilk zamanlar\u0131nda, mod\u00fcllerden \u00f6nce \"Internal Modules\" olarak bilinen ad alanlar\u0131 (namespaces) yayg\u0131n olarak kullan\u0131l\u0131yordu. G\u00fcn\u00fcm\u00fczde ise ad alanlar\u0131n\u0131n kullan\u0131m\u0131 genellikle daha azd\u0131r ve \u00e7o\u011fu yeni projede ES Mod\u00fclleri tercih edilir.<\/p>\n<h5>Ne Zaman Hangisini Kullanmal\u0131?<\/h5>\n<p>*   <strong>Mod\u00fcller (ES Mod\u00fclleri):<\/strong><br \/>\n    *   <strong>\u00d6nerilen Yakla\u015f\u0131m:<\/strong> Modern JavaScript ve TypeScript geli\u015ftirmesi i\u00e7in standart ve tercih edilen y\u00f6ntemdir.<br \/>\n    *   <strong>Dosya Bazl\u0131 Kapsam:<\/strong> Her dosya kendi ba\u015f\u0131na bir mod\u00fcld\u00fcr ve kendi \u00f6zel kapsam\u0131na sahiptir.<br \/>\n    *   <strong>Ba\u011f\u0131ml\u0131l\u0131k Y\u00f6netimi:<\/strong> <code>import<\/code>\/<code>export<\/code> ifadeleriyle a\u00e7\u0131k ve net ba\u011f\u0131ml\u0131l\u0131k grafi\u011fi olu\u015fturur.<br \/>\n    *   <strong>Ara\u00e7 Deste\u011fi:<\/strong> Modern paketleyiciler (Webpack, Rollup, Vite) ve derleme ara\u00e7lar\u0131 mod\u00fcllerle m\u00fckemmel \u00e7al\u0131\u015f\u0131r.<br \/>\n    *   <strong>\u00d6l\u00e7eklenebilirlik:<\/strong> B\u00fcy\u00fck ve karma\u015f\u0131k uygulamalar i\u00e7in idealdir.<\/p>\n<p>*   <strong>Ad Alanlar\u0131 (Namespaces):<\/strong><br \/>\n    *   <strong>Eski Yakla\u015f\u0131m:<\/strong> Genellikle daha eski veya \u00e7ok k\u00fc\u00e7\u00fck projelerde, tek bir global nesne alt\u0131nda kodu gruplamak i\u00e7in kullan\u0131l\u0131r.<br \/>\n    *   <strong>Global Kapsam:<\/strong> <code>namespace<\/code> i\u00e7indeki \u00f6\u011feler <code>export<\/code> edilmedi\u011fi s\u00fcrece <code>namespace<\/code>'e \u00f6zeldir, ancak <code>namespace<\/code>'in kendisi global kapsamda yer al\u0131r veya ba\u015fka bir <code>namespace<\/code> i\u00e7inde i\u00e7 i\u00e7e olabilir.<br \/>\n    *   <strong>Derleme \u00c7\u0131kt\u0131s\u0131:<\/strong> Genellikle tek bir JavaScript dosyas\u0131na derlenir ve global bir nesne olu\u015fturur.<br \/>\n    *   <strong>Kullan\u0131m Senaryolar\u0131:<\/strong> \u00c7ok basit yard\u0131mc\u0131 k\u00fct\u00fcphaneler veya global kapsamda belirli bir isim alt\u0131nda gruplama yapmak istendi\u011finde kullan\u0131labilir, ancak \u00e7o\u011fu durumda mod\u00fcller daha iyi bir se\u00e7enektir.<\/p>\n<pre><code class=\"language-typescript\">\/\/ namespaceExample.ts\nnamespace MyUtilities {\n    export function add(a: number, b: number): number {\n        return a + b;\n    }\n    export const PI = 3.14;\n}\n\n\/\/ app.ts (ayn\u0131 dosyada veya global olarak eri\u015filebilen ba\u015fka bir dosyada)\nconsole.log(MyUtilities.add(5, 10));\nconsole.log(MyUtilities.PI);<\/code><\/pre>\n<p>Ad alanlar\u0131, <code>\/\/\/ <reference path=\"...\" \/><\/code> y\u00f6nergeleri ile birlikte kullan\u0131l\u0131rd\u0131, ancak bu da mod\u00fcllerle b\u00fcy\u00fck \u00f6l\u00e7\u00fcde yerini alm\u0131\u015ft\u0131r.<\/p>\n<h5>Ge\u00e7mi\u015ften G\u00fcn\u00fcm\u00fcze Yakla\u015f\u0131m<\/h5>\n<p>TypeScript, ba\u015flang\u0131\u00e7ta kendi mod\u00fcl sistemini (Internal Modules, sonra Namespaces olarak yeniden adland\u0131r\u0131ld\u0131) sundu. Ancak JavaScript'in ES Mod\u00fcllerini benimsemesiyle, TypeScript de bu standard\u0131 tam olarak desteklemeye ve \u00f6ncelik vermeye ba\u015flad\u0131. G\u00fcn\u00fcm\u00fczde, yeni TypeScript projelerinde ad alanlar\u0131 yerine ES Mod\u00fcllerini kullanmak en iyi uygulamad\u0131r.<\/p>\n<h3>Mod\u00fcl Yap\u0131land\u0131rmas\u0131 ve Derleme S\u00fcreci<\/h3>\n<p><code>tsconfig.json<\/code> dosyas\u0131, TypeScript derleyicisinin nas\u0131l davranaca\u011f\u0131n\u0131 belirleyen ana yap\u0131land\u0131rma dosyas\u0131d\u0131r. Mod\u00fcllerle ilgili bir\u00e7ok \u00f6nemli ayar bu dosyada bulunur.<\/p>\n<h4><code>tsconfig.json<\/code>'da <code>module<\/code> ve <code>target<\/code> \u0130li\u015fkisi<\/h4>\n<p>*   <strong><code>target<\/code>:<\/strong> Derlenen JavaScript kodunun hangi ECMAScript s\u00fcr\u00fcm\u00fcn\u00fc hedefleyece\u011fini belirtir (\u00f6rne\u011fin, <code>es5<\/code>, <code>es2015<\/code>, <code>esnext<\/code>). Bu, dil \u00f6zelliklerinin (async\/await, arrow functions vb.) nas\u0131l d\u00f6n\u00fc\u015ft\u00fcr\u00fclece\u011fini etkiler.<br \/>\n*   <strong><code>module<\/code>:<\/strong> <code>import<\/code> ve <code>export<\/code> ifadelerinin hangi JavaScript mod\u00fcl sistemine d\u00f6n\u00fc\u015ft\u00fcr\u00fclece\u011fini belirtir (\u00f6rne\u011fin, <code>commonjs<\/code>, <code>esnext<\/code>, <code>node16<\/code>).<\/p>\n<p>Bu iki ayar birbiriyle ili\u015fkilidir. \u00d6rne\u011fin, <code>target: \"es5\"<\/code> ve <code>module: \"esnext\"<\/code> ayarlarsan\u0131z, TypeScript <code>esnext<\/code> mod\u00fcl s\u00f6zdizimini <code>es5<\/code> uyumlu CommonJS veya AMD gibi bir sisteme d\u00f6n\u00fc\u015ft\u00fcr\u00fcr. <code>target<\/code> genellikle <code>module<\/code>'dan daha eski bir s\u00fcr\u00fcme ayarlanabilir.<\/p>\n<h4><code>esModuleInterop<\/code> ve <code>allowSyntheticDefaultImports<\/code><\/h4>\n<p>*   <strong><code>esModuleInterop<\/code>:<\/strong> <code>true<\/code> olarak ayarland\u0131\u011f\u0131nda, ES Mod\u00fclleri ile CommonJS mod\u00fclleri aras\u0131ndaki uyumlulu\u011fu art\u0131r\u0131r. Bu, \u00f6zellikle CommonJS mod\u00fcllerini varsay\u0131lan import s\u00f6zdizimiyle (<code>import React from 'react'<\/code>) i\u00e7e aktar\u0131rken \u00f6nemlidir. Alt\u0131nda yatan mekanizma, CommonJS mod\u00fcllerinin <code>default<\/code> export'unu sim\u00fcle etmektir. Bu ayar genellikle <code>true<\/code> olarak \u00f6nerilir.<br \/>\n*   <strong><code>allowSyntheticDefaultImports<\/code>:<\/strong> <code>esModuleInterop<\/code> <code>false<\/code> oldu\u011funda ve bir CommonJS mod\u00fcl\u00fcn\u00fc varsay\u0131lan import ile i\u00e7e aktarmak istedi\u011finizde kullan\u0131l\u0131r. Sadece tip kontrol\u00fc i\u00e7in sentetik bir varsay\u0131lan import'a izin verir, ancak \u00e7al\u0131\u015fma zaman\u0131nda bir sorun ya\u015fanabilir. <code>esModuleInterop<\/code> genellikle <code>allowSyntheticDefaultImports<\/code>'u i\u00e7erir.<\/p>\n<h4><code>resolveJsonModule<\/code><\/h4>\n<p><code>true<\/code> olarak ayarland\u0131\u011f\u0131nda, <code>.json<\/code> uzant\u0131l\u0131 dosyalar\u0131 mod\u00fcl olarak i\u00e7e aktarman\u0131za izin verir. TypeScript, bu JSON dosyas\u0131n\u0131 tip g\u00fcvenli bir \u015fekilde <code>any<\/code> tipinde bir nesne olarak ele al\u0131r.<\/p>\n<pre><code class=\"language-json\">\/\/ data.json\n{\n  \"name\": \"TypeScript Module\",\n  \"version\": \"1.0.0\"\n}\n\n\/\/ app.ts\nimport * as data from '.\/data.json';\nconsole.log(data.name); \/\/ TypeScript Module<\/code><\/pre>\n<h4><code>isolatedModules<\/code><\/h4>\n<p><code>true<\/code> olarak ayarland\u0131\u011f\u0131nda, her dosyan\u0131n bir mod\u00fcl olarak ele al\u0131nmas\u0131n\u0131 ve ba\u011f\u0131ms\u0131z olarak derlenebilmesini sa\u011flar. Bu, Babel gibi d\u00f6n\u00fc\u015ft\u00fcr\u00fcc\u00fclerle birlikte TypeScript kullan\u0131rken veya Webpack gibi ara\u00e7larla <code>transpileOnly<\/code> modunu kullan\u0131rken \u00f6nemlidir. Bu ayar, TypeScript'in tek dosyal\u0131 derleme modunda \u00e7al\u0131\u015fmas\u0131na izin verir ve baz\u0131 tip kontrol g\u00fcvenliklerini devre d\u0131\u015f\u0131 b\u0131rakabilir (\u00f6rne\u011fin, <code>const enum<\/code> veya <code>export =<\/code> kullan\u0131lamaz).<\/p>\n<h4><code>typeRoots<\/code> ve <code>types<\/code><\/h4>\n<p>*   <strong><code>typeRoots<\/code>:<\/strong> TypeScript'in global tip tan\u0131mlama dosyalar\u0131n\u0131 (\u00f6rne\u011fin, <code>@types<\/code> paketleri) arayaca\u011f\u0131 dizinleri belirtir. Varsay\u0131lan olarak <code>.\/node_modules\/@types<\/code>'t\u0131r.<br \/>\n*   <strong><code>types<\/code>:<\/strong> Sadece belirli global tip tan\u0131mlama paketlerini dahil etmek istedi\u011finizde kullan\u0131l\u0131r. Belirtilenler d\u0131\u015f\u0131ndaki t\u00fcm <code>@types<\/code> paketleri g\u00f6z ard\u0131 edilir.<\/p>\n<p>Bu ayarlar, projenizin tip g\u00fcvenli\u011fini ve mod\u00fcl \u00e7\u00f6z\u00fcn\u00fcrl\u00fc\u011f\u00fcn\u00fc do\u011fru bir \u015fekilde y\u00f6netmek i\u00e7in kritik \u00f6neme sahiptir.<\/p>\n<h3>Pratik Uygulama ve En \u0130yi Y\u00f6ntemler<\/h3>\n<p>Mod\u00fclleri etkin bir \u015fekilde kullanmak i\u00e7in baz\u0131 en iyi y\u00f6ntemleri ve pratik ipu\u00e7lar\u0131n\u0131 takip etmek \u00f6nemlidir.<\/p>\n<h4>Her Dosya Bir Mod\u00fcl Prensibi<\/h4>\n<p>Modern TypeScript geli\u015ftirmede, her <code>.ts<\/code> veya <code>.tsx<\/code> dosyas\u0131n\u0131 ayr\u0131 bir mod\u00fcl olarak d\u00fc\u015f\u00fcnmek en iyi yakla\u015f\u0131md\u0131r. Bu, kodu daha d\u00fczenli hale getirir ve k\u00fcresel kapsam kirlili\u011fini tamamen \u00f6nler. A\u00e7\u0131k\u00e7a <code>export<\/code> veya <code>import<\/code> ifadeleri i\u00e7ermeyen dosyalar bile kendi \u00f6zel kapsam\u0131na sahip bir mod\u00fcl olarak kabul edilir.<\/p>\n<h4>\u0130yi Adland\u0131r\u0131lm\u0131\u015f Exportlar<\/h4>\n<p>D\u0131\u015fa aktard\u0131\u011f\u0131n\u0131z \u00f6\u011felere anlaml\u0131 ve a\u00e7\u0131klay\u0131c\u0131 adlar verin. Bu, mod\u00fcl\u00fcn\u00fcz\u00fc i\u00e7e aktaran di\u011fer geli\u015ftiricilerin neyi i\u00e7e aktard\u0131klar\u0131n\u0131 kolayca anlamalar\u0131n\u0131 sa\u011flar.<\/p>\n<pre><code class=\"language-typescript\">\/\/ K\u00f6t\u00fc\nexport const f = (a, b) => a + b;\n\n\/\/ \u0130yi\nexport const addNumbers = (a: number, b: number): number => a + b;<\/code><\/pre>\n<h4>Tek Varsay\u0131lan Export Kural\u0131 (\u0130ste\u011fe Ba\u011fl\u0131)<\/h4>\n<p>Baz\u0131 geli\u015ftirme ekipleri, bir mod\u00fcl\u00fcn yaln\u0131zca tek bir varsay\u0131lan export'a sahip olmas\u0131n\u0131 tercih eder. Bu, mod\u00fcl\u00fcn \"ana\" i\u015flevini netle\u015ftirir ve i\u00e7e aktarma s\u00f6zdizimini basitle\u015ftirir.<\/p>\n<pre><code class=\"language-typescript\">\/\/ component.ts\ninterface Props { \/<em> ... <\/em>\/ }\nexport default function MyComponent(props: Props) { \/<em> ... <\/em>\/ }\n\n\/\/ app.ts\nimport MyComponent from '.\/component';<\/code><\/pre>\n<p>Ancak, adland\u0131r\u0131lm\u0131\u015f exportlar da bir\u00e7ok senaryoda olduk\u00e7a kullan\u0131\u015fl\u0131d\u0131r, \u00f6zellikle bir mod\u00fclden birden fazla ilgili i\u015flevselli\u011fi d\u0131\u015fa aktar\u0131rken. Karar, projenin ve ekibin tercihine ba\u011fl\u0131d\u0131r.<\/p>\n<h4>Dairesel Ba\u011f\u0131ml\u0131l\u0131klar (Circular Dependencies) ve Ka\u00e7\u0131nma Yollar\u0131<\/h4>\n<p>Dairesel ba\u011f\u0131ml\u0131l\u0131k, Mod\u00fcl A'n\u0131n Mod\u00fcl B'ye, Mod\u00fcl B'nin de Mod\u00fcl A'ya ba\u011f\u0131ml\u0131 olmas\u0131 durumudur. Bu durum, uygulaman\u0131n beklenmedik \u015fekillerde davranmas\u0131na, \u00e7al\u0131\u015fma zaman\u0131 hatalar\u0131na veya performans\u0131 d\u00fc\u015f\u00fcrmesine neden olabilir.<\/p>\n<pre><code class=\"language-typescript\">\/\/ moduleA.ts\nimport { bFunction } from '.\/moduleB'; \/\/ A -> B\nexport function aFunction() {\n    console.log('aFunction called');\n    bFunction();\n}\n\n\/\/ moduleB.ts\nimport { aFunction } from '.\/moduleA'; \/\/ B -> A (Dairesel ba\u011f\u0131ml\u0131l\u0131k!)\nexport function bFunction() {\n    console.log('bFunction called');\n    \/\/ aFunction(); \/\/ Bu sat\u0131r Stack Overflow'a neden olabilir!\n}<\/code><\/pre>\n<p><strong>Ka\u00e7\u0131nma Yollar\u0131:<\/strong><br \/>\n1.  <strong>Yeniden Yap\u0131land\u0131rma:<\/strong> Kodu yeniden d\u00fczenleyerek ba\u011f\u0131ml\u0131l\u0131klar\u0131 tek y\u00f6nl\u00fc hale getirin. Ortak i\u015flevselli\u011fi \u00fc\u00e7\u00fcnc\u00fc bir mod\u00fcle ta\u015f\u0131y\u0131n.<br \/>\n2.  <strong>Gecikmeli Y\u00fckleme:<\/strong> Gerekirse, dinamik importlar (<code>import()<\/code>) kullanarak ba\u011f\u0131ml\u0131l\u0131klar\u0131 \u00e7al\u0131\u015fma zaman\u0131nda y\u00fckleyin.<br \/>\n3.  <strong>Aray\u00fczleri Ay\u0131rma:<\/strong> Aray\u00fczleri ve somut uygulamalar\u0131 farkl\u0131 mod\u00fcllere ay\u0131r\u0131n.<\/p>\n<h4>Test Edilebilirlik ve Mod\u00fcller<\/h4>\n<p>\u0130yi mod\u00fcler tasar\u0131m, kodun test edilebilirli\u011fini art\u0131r\u0131r. Her mod\u00fcl ba\u011f\u0131ms\u0131z bir birim olarak test edilebilir. Ba\u011f\u0131ml\u0131l\u0131klar\u0131 kolayca mock'layabilir veya stub'layabilirsiniz. Bu, birim testlerinin yaz\u0131lmas\u0131n\u0131 ve s\u00fcrd\u00fcr\u00fclmesini kolayla\u015ft\u0131r\u0131r.<\/p>\n<h3>Sonu\u00e7: Modern TypeScript Geli\u015ftirmede Mod\u00fcllerin Vazge\u00e7ilmezli\u011fi<\/h3>\n<p>TypeScript'te mod\u00fcller, modern ve \u00f6l\u00e7eklenebilir uygulamalar geli\u015ftirmenin temel ta\u015f\u0131d\u0131r. Kodun organizasyonunu, okunabilirli\u011fini ve bak\u0131m\u0131n\u0131 iyile\u015ftirerek geli\u015ftirme s\u00fcrecini daha verimli hale getirirler. <code>import<\/code> ve <code>export<\/code> anahtar kelimeleriyle ba\u015flayan bu yolculuk, CommonJS ve ES Mod\u00fclleri gibi farkl\u0131 mod\u00fcl sistemlerini anlamay\u0131, <code>tsconfig.json<\/code> dosyas\u0131ndaki <code>module<\/code>, <code>moduleResolution<\/code>, <code>esModuleInterop<\/code> gibi kritik ayarlar\u0131 yap\u0131land\u0131rmay\u0131 ve dinamik importlar veya mod\u00fcl bildirimleri gibi geli\u015fmi\u015f \u00f6zellikleri kullanmay\u0131 i\u00e7erir.<\/p>\n<p>Do\u011fru mod\u00fcl stratejisini se\u00e7mek, <code>tsconfig.json<\/code> ayarlar\u0131n\u0131 do\u011fru bir \u015fekilde yap\u0131land\u0131rmak ve en iyi uygulamalar\u0131 takip etmek, TypeScript projelerinizin sa\u011flam, s\u00fcrd\u00fcr\u00fclebilir ve performansl\u0131 olmas\u0131n\u0131 sa\u011flayacakt\u0131r. Mod\u00fcller, sadece kodunuzu par\u00e7alara ay\u0131rmaktan \u00f6te, daha iyi bir mimari, daha kolay i\u015fbirli\u011fi ve daha h\u0131zl\u0131 geli\u015ftirme d\u00f6ng\u00fcleri sunar. Dolay\u0131s\u0131yla, TypeScript ile \u00e7al\u0131\u015fan her geli\u015ftiricinin mod\u00fcl kavramlar\u0131n\u0131 derinlemesine anlamas\u0131 ve ustaca kullanmas\u0131 modern yaz\u0131l\u0131m geli\u015ftirmenin vazge\u00e7ilmez bir par\u00e7as\u0131d\u0131r.<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"TypeScript&#8217;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber\nGiri\u015f: Mod\u00fcllerin \u00d6nemi ve Neden \u0130htiya\u00e7 Duyuldu\u011fu\nModern yaz\u0131l\u0131m geli\u015fti","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-35038","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-genel","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>TypeScript&#039;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"TypeScript&#039;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber\" \/>\n<meta property=\"og:description\" content=\"TypeScript&#039;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber Giri\u015f: Mod\u00fcllerin \u00d6nemi ve Neden \u0130htiya\u00e7 Duyuldu\u011fu Modern yaz\u0131l\u0131m geli\u015fti\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-25T02:40:58+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"24 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"TypeScript&#8217;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber\",\"datePublished\":\"2025-11-25T02:40:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/\"},\"wordCount\":3784,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#respond\"]}],\"copyrightYear\":\"2025\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/\",\"name\":\"TypeScript'te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2025-11-25T02:40:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"TypeScript&#8217;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"TypeScript'te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/","og_locale":"tr_TR","og_type":"article","og_title":"TypeScript'te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber","og_description":"TypeScript'te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber Giri\u015f: Mod\u00fcllerin \u00d6nemi ve Neden \u0130htiya\u00e7 Duyuldu\u011fu Modern yaz\u0131l\u0131m geli\u015fti","og_url":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2025-11-25T02:40:58+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"24 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"TypeScript&#8217;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber","datePublished":"2025-11-25T02:40:58+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/"},"wordCount":3784,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#respond"]}],"copyrightYear":"2025","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/","url":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/","name":"TypeScript'te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2025-11-25T02:40:58+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/typescriptte-moduller-nasil-kullanilir-kapsamli-bir-rehber\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"TypeScript&#8217;te Mod\u00fcller Nas\u0131l Kullan\u0131l\u0131r: Kapsaml\u0131 Bir Rehber"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/35038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=35038"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/35038\/revisions"}],"predecessor-version":[{"id":35039,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/35038\/revisions\/35039"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=35038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=35038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=35038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}