惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
MongoDB | Blog
MongoDB | Blog
博客园_首页
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
B
Blog RSS Feed
D
Docker
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
V
V2EX
量子位
雷峰网
雷峰网
月光博客
月光博客
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
JavaScript vs TypeScript? Maybe We’ve Been Asking the Wro...
Habeeb Abdul · 2026-04-30 · via DEV Community
Cover image for JavaScript vs TypeScript? Maybe We’ve Been Asking the Wrong Question.

Habeeb Abdullahi

A lot of developers frame JavaScript vs TypeScript as a debate about which one is better or more professional.

But in real-world systems, that question often misses the real issue.

The difference between good and bad developers is rarely about the language. It is about understanding software design, data flow, and runtime behavior.

Let’s look at a practical example.


Bad TypeScript (Type Safety Without Real Safety)

This is a common pattern

type User = {
  id: string;
  name: string;
  email: string;
};

async function getUser(id: string): Promise<User> {
  const res = await fetch(`/api/user/${id}`);
  return res.json();
}


async function showUser(id) {
  const user = await getUser(id);
  console.log(user.email.toUpperCase())
  }

showUser("123");

Enter fullscreen mode Exit fullscreen mode

What is wrong here

On the surface this looks clean and type safe

But in reality

• The API response is not validated
• The server could return null or incomplete data
• TypeScript is being trusted blindly
• Runtime errors are still possible

This is what happens when TypeScript is used as a replacement for validation instead of a supplement


✅ Better JavaScript (Safer Through Design)

Now compare this approach

function isUser(data) {
  return (
    data &&
    typeof data.id === "string" &&
    typeof data.name === "string" &&
    typeof data.email === "string"
  );
}

async function getUser(id) {
  const res = await fetch(`/api/user/${id}`);
  const data = await res.json();

  if (!isUser(data)) {
    throw new Error("Invalid user data received from API");
  }

  return data;
}

async function showUser(id) {
  try {
    const user = await getUser(id);
    console.log(user.email.toUpperCase());
  } catch (err) {
    console.error("Failed to load user:", err.message);
  }
}
showUser("123");

Enter fullscreen mode Exit fullscreen mode


Why this JavaScript approach can actually be safer

• It validates real runtime data instead of assumptions
• It fails explicitly when something is wrong
• It separates concerns between fetching, validation, and usage
• It scales naturally into schema based systems like Zod or Joi


The real takeaway

TypeScript improves developer experience and static safety.

But:

real world safety comes from architecture, validation, and understanding runtime behavior, not types alone.

A comparison of two security models: a cracked blue holographic shield labeled 'Type Safety' next to a solid, reinforced yellow vault door labeled 'Real Safety'
You can write unsafe TypeScript and safe JavaScript.

The difference is not the language.

It is the engineering discipline behind it.


If you are serious about frontend engineering, the real question is not:

JavaScript or TypeScript

It is:

Do I understand what actually happens when my code runs?


A glowing vintage scale balancing a yellow JS cube and a blue TS cube, supported by a heavy mechanical base labeled 'Software Design & Fundamentals' and 'Real-World Safety'.

What’s your take? Does TypeScript make better developers or do fundamentals matter more?