<?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>DEV Community: Irvan Gerhana Septiyana</title>
    <description>The latest articles on DEV Community by Irvan Gerhana Septiyana (@uigerhana).</description>
    <link>https://dev.to/uigerhana</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%2F2981481%2F01111859-f264-40c3-ae71-c80672ce7349.png</url>
      <title>DEV Community: Irvan Gerhana Septiyana</title>
      <link>https://dev.to/uigerhana</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/uigerhana"/>
    <language>en</language>
    <item>
      <title>Vibe Coding with AI? Don't Forget These Security Fundamentals</title>
      <dc:creator>Irvan Gerhana Septiyana</dc:creator>
      <pubDate>Tue, 22 Apr 2025 00:47:36 +0000</pubDate>
      <link>https://dev.to/uigerhana/vibe-coding-with-ai-dont-forget-these-security-fundamentals-3ac2</link>
      <guid>https://dev.to/uigerhana/vibe-coding-with-ai-dont-forget-these-security-fundamentals-3ac2</guid>
      <description>&lt;h2&gt;
  
  
  🧠 Vibe Coding with AI? Don't Forget These Frontend Security Fundamentals
&lt;/h2&gt;

&lt;p&gt;AI is changing how we write frontend code.&lt;br&gt;&lt;br&gt;
We autocomplete faster, generate entire UI components, even build APIs with a prompt.&lt;/p&gt;

&lt;p&gt;But while you're shipping faster, are you securing smarter?&lt;/p&gt;

&lt;p&gt;Here’s a &lt;strong&gt;Frontend Security Cheatsheet&lt;/strong&gt; designed for modern devs coding with AI assistants (Copilot, GPT, etc).&lt;/p&gt;




&lt;h2&gt;
  
  
  🔐 JWT (JSON Web Token) Security Tips
&lt;/h2&gt;

&lt;p&gt;Your Copilot might scaffold token handling fast, but make sure you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never store JWTs in localStorage&lt;/li&gt;
&lt;li&gt;Prefer &lt;code&gt;HttpOnly&lt;/code&gt;, &lt;code&gt;Secure&lt;/code&gt; cookies&lt;/li&gt;
&lt;li&gt;Always verify token on backend&lt;/li&gt;
&lt;li&gt;Rotate access tokens + secrets periodically&lt;/li&gt;
&lt;li&gt;Set short-lived access tokens with refresh strategies&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Many AI suggestions use insecure defaults. Double-check token logic.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🧼 Preventing XSS (Cross-Site Scripting)
&lt;/h2&gt;

&lt;p&gt;LLMs love &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt;, but you shouldn’t.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always sanitize user input (&lt;code&gt;DOMPurify&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Escape dynamic content in your components&lt;/li&gt;
&lt;li&gt;Use strong CSP headers&lt;/li&gt;
&lt;li&gt;Never blindly trust what comes from GPT-generated data injection&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧨 Prevent SQLi via your UI
&lt;/h2&gt;

&lt;p&gt;It’s a backend issue — but your frontend may accidentally leak patterns.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sanitize form data before send&lt;/li&gt;
&lt;li&gt;Validate with zod/yup before fetch&lt;/li&gt;
&lt;li&gt;Never expose raw queries or GraphQL playgrounds to public users&lt;/li&gt;
&lt;li&gt;Use enums and schemas, not raw strings&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧷 CSRF Prevention Essentials
&lt;/h2&gt;

&lt;p&gt;If your Copilot-built backend uses cookie-based auth:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always use &lt;code&gt;SameSite=Strict&lt;/code&gt; or &lt;code&gt;Lax&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Prefer token-based auth via &lt;code&gt;Authorization&lt;/code&gt; headers&lt;/li&gt;
&lt;li&gt;Use CSRF tokens for sensitive forms&lt;/li&gt;
&lt;li&gt;Don’t trust origin headers unless validated&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛡️ Secure API Design with AI Tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Validate data on &lt;strong&gt;both ends&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Use role-based access control (RBAC)&lt;/li&gt;
&lt;li&gt;Rate-limit endpoints — especially AI-enhanced features&lt;/li&gt;
&lt;li&gt;Use HTTPS + proper CORS configuration&lt;/li&gt;
&lt;li&gt;Never expose admin tools via public routes&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🧠 AI scaffolds APIs quickly — but securing them takes conscious review.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  ✨ Bonus: Vibe Coding ≠ Secure Coding
&lt;/h2&gt;

&lt;p&gt;Your GPT might build the login system —&lt;br&gt;&lt;br&gt;
But it’s your job to think like an attacker.&lt;/p&gt;




&lt;h3&gt;
  
  
  🎁 Want to go deeper?
&lt;/h3&gt;

&lt;p&gt;I’ve built a complete &lt;strong&gt;eBook + Snippet Repo&lt;/strong&gt; for AI-enhanced coding teams.&lt;br&gt;&lt;br&gt;
It’s packed with examples, cheatsheets, and modern security best practices — for both frontend &amp;amp; backend.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://uigerhana.gumroad.com/l/vibe-coding-security" rel="noopener noreferrer"&gt;https://uigerhana.gumroad.com/l/vibe-coding-security&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Perfect for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web devs coding with Copilot / GPT&lt;/li&gt;
&lt;li&gt;Teams using AI tools to scaffold their apps&lt;/li&gt;
&lt;li&gt;Frontend engineers who care about real-world security&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Let’s build cool stuff — and keep it safe.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let me know what security holes you've seen from AI-generated code 👇&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Hidden Risks of Coding with AI Agents (and How to Avoid Them)</title>
      <dc:creator>Irvan Gerhana Septiyana</dc:creator>
      <pubDate>Wed, 16 Apr 2025 16:37:36 +0000</pubDate>
      <link>https://dev.to/uigerhana/the-hidden-risks-of-coding-with-ai-agents-and-how-to-avoid-them-1hd2</link>
      <guid>https://dev.to/uigerhana/the-hidden-risks-of-coding-with-ai-agents-and-how-to-avoid-them-1hd2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;AI can speed up your workflow. But hidden beneath that convenience are risks you can’t afford to ignore.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the rush to adopt AI-powered coding agents like ChatGPT, Claude, Cursor, and GitHub Copilot, many developers forget a basic truth: &lt;strong&gt;code is not just about what works—it’s about what’s safe, secure, and maintainable&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This article explores the hidden risks of AI-assisted development, based on real-world experience, and offers clear, actionable strategies to avoid those pitfalls.&lt;/p&gt;




&lt;h2&gt;
  
  
  Risk #1: Code That Looks Right But Fails Silently
&lt;/h2&gt;

&lt;p&gt;AI often generates syntactically correct code that compiles and runs—but behaves incorrectly under specific conditions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real Case&lt;/strong&gt;: Silent Data Corruption in an AI-Suggested Function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// AI-generated
function updateInventory(itemId, quantity) {
  db.items.find({ id: itemId }).quantity += quantity;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks fine, right? But it's not updating the database—find() returns a copy, not a reference. This can silently corrupt logic across production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;await db.items.updateOne({ id: itemId }, { $inc: { quantity } });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Avoid it&lt;/strong&gt;: Always verify the data model and database methods used. AI doesn’t know your schema.&lt;/p&gt;




&lt;h2&gt;
  
  
  Risk #2: Security Loopholes from Missing Context
&lt;/h2&gt;

&lt;p&gt;AI often omits critical context like authentication, authorization, and sanitization—especially for dynamic routes or forms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real Case&lt;/strong&gt;: No Authorization Check in Admin Route&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get('/admin/export', async (req, res) =&amp;gt; {
  const data = await getSensitiveData();
  res.send(data);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No middleware. No access control. This route might be exposed in production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get('/admin/export', isAuthenticated, isAdmin, async (req, res) =&amp;gt; {
  const data = await getSensitiveData();
  res.send(data);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Avoid it&lt;/strong&gt;: Add security prompts, then review every route manually for access control.&lt;/p&gt;




&lt;h2&gt;
  
  
  Risk #3: Dependency Injection with Untrusted Inputs
&lt;/h2&gt;

&lt;p&gt;AI might unknowingly suggest logic that injects user-controlled variables into unsafe contexts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real Case&lt;/strong&gt;: Template Injection via Unescaped Variables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res.send(`&amp;lt;div&amp;gt;Hello ${req.query.name}&amp;lt;/div&amp;gt;`);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;name&lt;/code&gt;is &lt;code&gt;&amp;lt;script&amp;gt;alert(1)&amp;lt;/script&amp;gt;&lt;/code&gt;, you've got XSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const escape = require('escape-html');
res.send(`&amp;lt;div&amp;gt;Hello ${escape(req.query.name)}&amp;lt;/div&amp;gt;`);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Avoid it&lt;/strong&gt;: Never trust output that uses user input—always escape or sanitize.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Use AI Without Falling into These Traps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Prompt defensively&lt;/strong&gt;: Include terms like "secure", "safe", "type-checked", and "idiomatic" in your prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit everything&lt;/strong&gt;: Assume nothing is production-ready. Review for correctness, safety, and context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pair with static analysis&lt;/strong&gt;: Use tools like ESLint, SonarQube, or SAST to catch structural flaws.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write tests (with AI)&lt;/strong&gt;: Ask AI to generate edge case tests, then extend them yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use AI as a second brain—not a second engineer&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;Final Take&lt;/strong&gt;&lt;br&gt;
AI agents are brilliant at surfacing ideas and saving time. But when it comes to secure, maintainable code—you’re still the expert in the room.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trust your judgment, not the autocomplete.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Let’s Talk&lt;/strong&gt;: What’s the worst AI-generated bug you’ve seen? What’s your system for catching subtle mistakes before they go live?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>ai</category>
      <category>discuss</category>
    </item>
    <item>
      <title>How I Use AI Agents Without Compromising Code Quality &amp; Security</title>
      <dc:creator>Irvan Gerhana Septiyana</dc:creator>
      <pubDate>Mon, 14 Apr 2025 04:49:36 +0000</pubDate>
      <link>https://dev.to/uigerhana/how-i-use-ai-agents-without-compromising-code-quality-security-55c0</link>
      <guid>https://dev.to/uigerhana/how-i-use-ai-agents-without-compromising-code-quality-security-55c0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I'm not anti-AI. But I don't trust AI-generated code blindly either.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the past year, I’ve integrated multiple AI coding assistants into my workflow—tools like Cursor, Claude, and GitHub Copilot. They’ve helped me work faster, think clearer, and explore more creative solutions. But one thing has never changed: &lt;strong&gt;I’m responsible for the code I ship&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So this article isn’t about how cool AI is (though it is). &lt;strong&gt;It’s about how I use AI responsibly—without compromising on quality or security&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why You Shouldn’t Trust AI Code Blindly
&lt;/h2&gt;

&lt;p&gt;AI code often looks right—but that doesn’t mean it is right. Here’s why I treat AI suggestions like I’m mentoring a junior dev:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Surface-level correctness&lt;/strong&gt;: AI might give you working code, but with poor performance, edge case issues, or security holes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual gaps&lt;/strong&gt;: AI doesn't always understand the broader architecture or business logic of your app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security ignorance&lt;/strong&gt;: Most AI doesn’t sanitize inputs, escape dangerous characters, or follow security best practices unless prompted very explicitly.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  My AI Coding Workflow (With Safety Layers)
&lt;/h2&gt;

&lt;p&gt;I break down my workflow into these steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Prompting Like an Engineer&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;"Build a secure login form using Express + TypeScript. Use input validation and avoid SQL injection vulnerabilities."&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Review Every Line&lt;/strong&gt;&lt;br&gt;
Never trust a copy-paste. I manually review and revise code from AI, focusing on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;li&gt;Type safety&lt;/li&gt;
&lt;li&gt;Dependency usage&lt;/li&gt;
&lt;li&gt;Potential edge cases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Run Static Analysis &amp;amp; Linting&lt;/strong&gt;&lt;br&gt;
I treat every AI output like PR code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ESLint / Prettier for style&lt;/li&gt;
&lt;li&gt;TypeScript strict mode&lt;/li&gt;
&lt;li&gt;SonarQube or similar tools for security/code smell audits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Test Everything&lt;/strong&gt;&lt;br&gt;
I often ask the AI to help me generate tests too:&lt;br&gt;
&lt;code&gt;"Write unit tests for this function using Jest."&lt;/code&gt;&lt;br&gt;
Then I run them and look for edge cases it might’ve missed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Stay in the Loop on Vulnerabilities&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;npm audit&lt;/code&gt;, &lt;code&gt;yarn audit&lt;/code&gt;, or &lt;code&gt;pnpm audit&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Watch out for AI-suggested libraries with low downloads or suspicious reputations&lt;/li&gt;
&lt;li&gt;Use tools like Snyk or Dependabot for ongoing dependency scanning&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Secure Coding Principles I Stick To (Even with AI)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No hardcoded secrets&lt;/strong&gt; – Use &lt;code&gt;.env&lt;/code&gt; or secret managers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never eval() anything blindly&lt;/strong&gt; – Especially AI-suggested dynamic code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate user inputs&lt;/strong&gt; – Always, even in internal tools&lt;/li&gt;
&lt;li&gt;Use parameterized queries – Avoid string concatenation in DB queries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolate unsafe code&lt;/strong&gt; – Sanbox where possible (e.g., with iframes or workers)&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  What AI Still Gets Wrong (and You Need to Catch)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Suggesting outdated or vulnerable libraries&lt;/li&gt;
&lt;li&gt;Repeating logic that bloats your codebase&lt;/li&gt;
&lt;li&gt;Skipping null-checks and runtime validation&lt;/li&gt;
&lt;li&gt;Missing authorization checks in protected routes&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;AI can be an incredible ally—but only if you’re still the engineer in charge. If you care about your users, your app’s stability, and your own sanity, &lt;strong&gt;treat AI like a junior assistant—not an autopilot&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The future of development isn’t AI replacing you. It’s you learning how to lead AI in writing better, safer, and smarter code.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Let’s Discuss&lt;/strong&gt;: How do you make sure your AI-assisted code is safe and production-ready? What tools or habits do you swear by?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Memahami Fundamental TypeScript: Panduan Lengkap untuk Pemula</title>
      <dc:creator>Irvan Gerhana Septiyana</dc:creator>
      <pubDate>Thu, 27 Mar 2025 11:57:17 +0000</pubDate>
      <link>https://dev.to/uigerhana/memahami-fundamental-typescript-panduan-lengkap-untuk-pemula-3n2b</link>
      <guid>https://dev.to/uigerhana/memahami-fundamental-typescript-panduan-lengkap-untuk-pemula-3n2b</guid>
      <description>&lt;h2&gt;
  
  
  Pendahuluan
&lt;/h2&gt;

&lt;p&gt;TypeScript adalah superset dari JavaScript yang menambahkan dukungan tipe statis. Dengan TypeScript, kita bisa menulis kode yang lebih aman, mudah di-maintain, dan lebih mudah didokumentasikan. Artikel ini membahas dasar-dasar TypeScript secara lengkap, mulai dari instalasi hingga konsep lanjutan seperti Generics dan Error Handling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mengapa Menggunakan TypeScript?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deteksi Error di Waktu Kompilasi&lt;/strong&gt;: Mengurangi bug saat runtime&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Meningkatkan Produktivitas&lt;/strong&gt;: Dukungan autocompletion dan dokumentasi di editor (seperti VSCode).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Skalabilitas&lt;/strong&gt;: Cocok untuk proyek besar karena memiliki fitur modular dan type-checking.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Studi Kasus: Kapan Sebaiknya Menggunakan TypeScript?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Saat membangun aplikasi berskala besar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ketika bekerja dalam tim besar untuk meminimalisasi kesalahan.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Untuk meningkatkan performa debugging dan prediktabilitas kode.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Memulai dengan TypeScript
&lt;/h2&gt;

&lt;p&gt;Global Installasi TypeScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;install -g typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inisialisasi Proyek TypeScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tsc --init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Menjalankan Kode TypeScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tsc index.ts &amp;amp;&amp;amp; node index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Tipe Data Dasar (Primitive Types)
&lt;/h2&gt;

&lt;p&gt;String, Number, Boolean&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let nama: string = "Irvan";
let usia: number = 27;
let aktif: boolean = true;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Array &amp;amp; Tuple&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let angka: number[] = [1, 2, 3];
let biodata: [string, number] = ["Irvan", 27];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any, Unknown, Never&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let random: any = "Bebas";
let value: unknown = 42;
function throwError(): never {
  throw new Error("Terjadi Kesalahan");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Tipe Kompleks (Object, Enum, Union)
&lt;/h2&gt;

&lt;p&gt;Object&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type User = {
  id: number;
  name: string;
};

let user: User = { id: 1, name: "Irvan" };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enum&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;enum Role {
  Admin,
  User,
  Guest,
}

let role: Role = Role.Admin;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Union &amp;amp; Intersection&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let id: string | number = "123";

interface Person {
  name: string;
}

interface Employee {
  id: number;
}

type Staff = Person &amp;amp; Employee;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Function di TypeScript
&lt;/h2&gt;

&lt;p&gt;Mendefinisikan Tipe Parameter dan Return&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function tambah(a: number, b: number): number {
  return a + b;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Optional &amp;amp; Default Parameters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sapa(nama: string, umur?: number) {
  console.log(`Halo ${nama}`);
}

function greeting(name: string = "User") {
  console.log(`Welcome, ${name}`);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Interface vs Type Alias
&lt;/h2&gt;

&lt;p&gt;Interface&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface Person {
  nama: string;
  umur: number;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type Alias&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type ID = string | number;

type User = {
  id: ID;
  name: string;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perbedaan Utama:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;interface&lt;/code&gt; cocok untuk object yang besar dan dapat di-extend.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;type&lt;/code&gt; lebih fleksibel dan cocok untuk union atau intersection types.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Class dan Inheritance di TypeScript
&lt;/h2&gt;

&lt;p&gt;Class Dasar&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User {
  constructor(public name: string, private age: number) {}

  getAge(): number {
    return this.age;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inheritance (Pewarisan)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Admin extends User {
  constructor(name: string, age: number, public role: string) {
    super(name, age);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Generics (Tipe Dinamis dan Fleksibel)
&lt;/h2&gt;

&lt;p&gt;Generics memungkinkan kita membuat fungsi atau class yang dapat bekerja dengan berbagai tipe data tanpa kehilangan keamanan tipe.&lt;/p&gt;

&lt;p&gt;Generics adalah seperti wadah fleksibel yang bisa menyimpan berbagai jenis barang, seperti kotak yang bisa diisi mainan atau buku.&lt;/p&gt;

&lt;p&gt;Contoh Penggunaan Generics&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function wrap&amp;lt;T&amp;gt;(value: T): T[] {
  return [value];
}

const angka = wrap&amp;lt;number&amp;gt;(5);
const kata = wrap&amp;lt;string&amp;gt;("Hello");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Error Handling di TypeScript
&lt;/h2&gt;

&lt;p&gt;TypeScript memungkinkan penanganan error dengan menggunakan try-catch dan tipe khusus.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
  throw new Error("Terjadi Kesalahan");
} catch (error) {
  console.error((error as Error).message);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Kesimpulan
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript membantu membangun aplikasi yang lebih aman dan terstruktur.&lt;/li&gt;
&lt;li&gt;Pahami dasar seperti tipe data, fungsi, class, dan generics.&lt;/li&gt;
&lt;li&gt;Selalu gunakan strict mode di tsconfig.json untuk validasi lebih ketat.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rekomendasi Selanjutnya:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pelajari lebih lanjut tentang Mapped Types dan Utility Types.&lt;/li&gt;
&lt;li&gt;Optimalkan proyek Anda dengan praktik terbaik TypeScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sumber Tambahan:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/docs/" rel="noopener noreferrer"&gt;TypeScript Handbook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html" rel="noopener noreferrer"&gt;Praktik Terbaik TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

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