<?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: vladimir ivanov</title>
    <description>The latest articles on DEV Community by vladimir ivanov (@vladimirivanov).</description>
    <link>https://dev.to/vladimirivanov</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3923257%2F17814b23-2202-42e0-9e1f-26e40af89c35.jpeg</url>
      <title>DEV Community: vladimir ivanov</title>
      <link>https://dev.to/vladimirivanov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vladimirivanov"/>
    <language>en</language>
    <item>
      <title>33,000+ strictNullChecks Errors Later: Why null Belongs Only at Our Boundaries</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 22 Nov 2026 15:26:28 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/50000-strictnullchecks-errors-later-why-null-belongs-only-at-our-boundaries-2blc</link>
      <guid>https://dev.to/vladimirivanov/50000-strictnullchecks-errors-later-why-null-belongs-only-at-our-boundaries-2blc</guid>
      <description>&lt;p&gt;For years, I had a simple, unspoken rule in TypeScript: always use &lt;code&gt;undefined&lt;/code&gt;, never &lt;code&gt;null&lt;/code&gt;. It worked cleanly, my types stayed simple, and I never gave it a second thought.&lt;/p&gt;

&lt;p&gt;Then I joined my current contract.&lt;/p&gt;

&lt;p&gt;It's a large monorepo with 50+ fullstack developers, and when it comes to empty values, it is pure chaos. Without a shared convention, everyone just guesses. Some developers reset form fields to &lt;code&gt;null&lt;/code&gt;, others use &lt;code&gt;undefined&lt;/code&gt;, and some use empty strings. Because data flows back and forth to a backend running Apache Avro (which explicitly turns missing values into &lt;code&gt;null&lt;/code&gt; over the wire), &lt;code&gt;null&lt;/code&gt; slowly bled into every corner of our React components, utility functions, and state management.&lt;/p&gt;

&lt;p&gt;To make matters worse, &lt;code&gt;strictNullChecks&lt;/code&gt; had been disabled from day one, eight years ago. When we finally turned it back on, TypeScript surfaced over 33,000 errors. We had to add thousands of &lt;code&gt;// @ts-expect-error strict null check violation&lt;/code&gt; comments just to keep builds green while we chip away at the cleanup.&lt;/p&gt;

&lt;p&gt;Staring at 33,000 nullability errors makes one thing painfully clear: "just pick whichever feels right" does not scale.&lt;/p&gt;

&lt;p&gt;If you search Dev.to or Medium for &lt;code&gt;null&lt;/code&gt; vs. &lt;code&gt;undefined&lt;/code&gt;, you'll mostly find beginner definitions (&lt;code&gt;typeof null === 'object'&lt;/code&gt;) or outdated advice from the vanilla JavaScript days telling you to use &lt;code&gt;null&lt;/code&gt; for "intentional" absence. That advice falls apart in a real-world, multi-language TypeScript architecture.&lt;/p&gt;

&lt;p&gt;So I sat down and worked out a clear, practical standard: when &lt;code&gt;null&lt;/code&gt; is genuinely required, when it should be strictly banned, and how to stop it from poisoning an entire codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why "Use null for Intentional Absence" Breaks Down in TypeScript
&lt;/h2&gt;

&lt;p&gt;If you read older JavaScript blog posts on this topic, you'll almost always see the same advice: "Never assign &lt;code&gt;undefined&lt;/code&gt; yourself. Leave &lt;code&gt;undefined&lt;/code&gt; for the JavaScript engine, and always use &lt;code&gt;null&lt;/code&gt; when you intentionally want to clear a value."&lt;/p&gt;

&lt;p&gt;Back in the untyped ES5 days, that made sense. If you saw &lt;code&gt;Cannot read properties of undefined&lt;/code&gt; in your browser console, you knew you had a bug: an uninitialized variable or a typo in a property name. If you saw &lt;code&gt;null&lt;/code&gt;, you knew a developer put it there on purpose.&lt;/p&gt;

&lt;p&gt;In modern TypeScript, that exact habit actively hurts you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The compiler already catches accidental &lt;code&gt;undefined&lt;/code&gt;.&lt;/strong&gt; With &lt;code&gt;strictNullChecks&lt;/code&gt; (and &lt;code&gt;noUncheckedIndexedAccess&lt;/code&gt;), TypeScript warns you before your code ever runs if you forget to initialize a variable or access a missing key. You don't need two different runtime primitives just to debug typos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You can never eliminate &lt;code&gt;undefined&lt;/code&gt;.&lt;/strong&gt; Optional parameters (&lt;code&gt;fn(x?: string)&lt;/code&gt;), &lt;code&gt;Array.prototype.find()&lt;/code&gt;, and missing object keys all evaluate to &lt;code&gt;undefined&lt;/code&gt;. If you insist on assigning &lt;code&gt;null&lt;/code&gt; everywhere, you don't replace &lt;code&gt;undefined&lt;/code&gt;. You end up juggling both (&lt;code&gt;string | null | undefined&lt;/code&gt;) across your entire app.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That is why the TypeScript compiler team explicitly bans &lt;code&gt;null&lt;/code&gt; in their own coding guidelines: "Use &lt;code&gt;undefined&lt;/code&gt;. Do not use &lt;code&gt;null&lt;/code&gt;."&lt;/p&gt;

&lt;p&gt;Of course, the TypeScript compiler doesn't talk to browsers, form libraries, or Avro schemas. Web apps do. So the real question isn't "which one is better?" It's where &lt;code&gt;undefined&lt;/code&gt; belongs, and where &lt;code&gt;null&lt;/code&gt; is unavoidable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inside Your App: Keep It 100% null-Free
&lt;/h2&gt;

&lt;p&gt;Inside your own TypeScript business logic, React components, and state management, &lt;code&gt;undefined&lt;/code&gt; should be the single source of truth for "nothing here."&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Default parameters and optional chaining just work
&lt;/h3&gt;

&lt;p&gt;JavaScript's built-in ergonomics are designed around &lt;code&gt;undefined&lt;/code&gt;, not &lt;code&gt;null&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;formatDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"NONE"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sb"&gt;`Promo: ${code}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;formatDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "Promo: NONE"&lt;/span&gt;
&lt;span class="nf"&gt;formatDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "Promo: null" -&amp;gt; breaks the default!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every time &lt;code&gt;null&lt;/code&gt; sneaks into your domain layer, default parameters silently fail, and you end up littering your components with defensive &lt;code&gt;value ?? ''&lt;/code&gt; checks.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Expressing "intentional absence": &lt;code&gt;name?: string&lt;/code&gt; vs. &lt;code&gt;name: string | undefined&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;One valid concern from the "pro-null" camp is: "If I use &lt;code&gt;undefined&lt;/code&gt;, how do I show that an empty value was intentional rather than forgotten?"&lt;/p&gt;

&lt;p&gt;TypeScript gives you a much better way to express that at compile time, without touching &lt;code&gt;null&lt;/code&gt;: separate optional properties/parameters (&lt;code&gt;?&lt;/code&gt;) from explicitly undefinable ones (&lt;code&gt;| undefined&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Optional: easy to accidentally forget during a refactor&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;phoneNumber&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;updateProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"user-123"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Compiles fine, even if you forgot phoneNumber!&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Required, but accepts undefined: forces an explicit decision&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateProfileStrict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;phoneNumber&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;updateProfileStrict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"user-123"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ❌ Type error: Expected 2 arguments, but got 1.&lt;/span&gt;
&lt;span class="nf"&gt;updateProfileStrict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"user-123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ✅ Explicitly cleared/empty&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a function takes multiple parameters, &lt;code&gt;param: T | undefined&lt;/code&gt; guarantees that every caller consciously passes a value (or explicitly passes &lt;code&gt;undefined&lt;/code&gt;) rather than silently omitting it.&lt;/p&gt;

&lt;p&gt;If you enable &lt;code&gt;exactOptionalPropertyTypes&lt;/code&gt; in &lt;code&gt;tsconfig.json&lt;/code&gt;, TypeScript enforces the same distinction on object properties too: &lt;code&gt;{ phoneNumber?: string }&lt;/code&gt; means the key can be omitted, while &lt;code&gt;{ phoneNumber: string | undefined }&lt;/code&gt; means the key must be present.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Forms and user input: no null in form state either
&lt;/h3&gt;

&lt;p&gt;Forms are one of the biggest sources of &lt;code&gt;null&lt;/code&gt; chaos in large teams. Developers often initialize or reset fields to &lt;code&gt;null&lt;/code&gt; because they think "the backend expects &lt;code&gt;null&lt;/code&gt; when this field is empty."&lt;/p&gt;

&lt;p&gt;Keep &lt;code&gt;null&lt;/code&gt; completely out of your form state:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Text inputs&lt;/strong&gt; should use &lt;code&gt;""&lt;/code&gt; (empty string). React will literally warn you in the console if you pass &lt;code&gt;value={null}&lt;/code&gt; to a controlled &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-text inputs&lt;/strong&gt; (dates, selects, custom pickers) should use &lt;code&gt;undefined&lt;/code&gt; when uninitialized or reset.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your UI and validation schemas (like Zod or Valibot) stay clean, predictable, and free of &lt;code&gt;string | null | undefined&lt;/code&gt; unions. If your backend needs &lt;code&gt;null&lt;/code&gt; when a user clears a field, that translation happens at the network boundary right before submitting, never inside your component state.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Only Frontend Exception: Built-in Framework and DOM APIs
&lt;/h2&gt;

&lt;p&gt;Frontend frameworks and browser APIs have a few unavoidable &lt;code&gt;null&lt;/code&gt; quirks, and you'll run into them across the ecosystem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;React:&lt;/strong&gt; &lt;code&gt;useRef&amp;lt;HTMLDivElement&amp;gt;(null)&lt;/code&gt; for DOM refs, and returning &lt;code&gt;null&lt;/code&gt; from a component to render nothing. Historically, React threw a runtime error if a component returned &lt;code&gt;undefined&lt;/code&gt;, which trained a generation of developers to return &lt;code&gt;null&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Angular:&lt;/strong&gt; &lt;code&gt;form.reset()&lt;/code&gt; defaults controls to &lt;code&gt;null&lt;/code&gt; (unless configured with &lt;code&gt;nonNullable: true&lt;/code&gt;), and the &lt;code&gt;async&lt;/code&gt; pipe emits &lt;code&gt;null&lt;/code&gt; before data resolves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser APIs:&lt;/strong&gt; &lt;code&gt;document.querySelector()&lt;/code&gt; returns &lt;code&gt;null&lt;/code&gt; when nothing matches, and there are similar edges elsewhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Treat these strictly as framework/DOM boundary quirks. Keep &lt;code&gt;null&lt;/code&gt; contained to those touchpoints and never let it bleed into your state, props, or business logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Boundaries: Where null Becomes Non-Negotiable
&lt;/h2&gt;

&lt;p&gt;If &lt;code&gt;undefined&lt;/code&gt; is so much cleaner inside TypeScript, why does &lt;code&gt;null&lt;/code&gt; keep invading our codebases? Because your TypeScript app doesn't live in a vacuum. The moment data crosses a network boundary, a serialization layer, or a language barrier, you leave JavaScript's two-empty-values world behind.&lt;/p&gt;

&lt;p&gt;Here are the four boundaries where &lt;code&gt;null&lt;/code&gt; is a hard requirement, and why you must treat them differently from your internal code.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. JSON and REST PATCH requests (omit vs. clear)
&lt;/h3&gt;

&lt;p&gt;In JSON, &lt;code&gt;undefined&lt;/code&gt; does not exist as a data type. When you call &lt;code&gt;JSON.stringify()&lt;/code&gt;, properties with &lt;code&gt;undefined&lt;/code&gt; values are silently stripped out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Vlad"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// '{"name":"Vlad"}'&lt;/span&gt;
&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Vlad"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// '{"name":"Vlad","phone":null}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a REST PATCH endpoint, that distinction is critical:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;undefined&lt;/code&gt; (omitted key): "Leave &lt;code&gt;phone&lt;/code&gt; untouched in the database."&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;null&lt;/code&gt; (explicit key): "Clear &lt;code&gt;phone&lt;/code&gt; in the database."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is why your form state should stay &lt;code&gt;""&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt; while the user edits. If your API uses these omit/clear semantics, your submit mapper converts cleared fields to &lt;code&gt;null&lt;/code&gt; right before calling &lt;code&gt;fetch&lt;/code&gt; or &lt;code&gt;axios&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Multi-language backends (Java, Python, Rust)
&lt;/h3&gt;

&lt;p&gt;Most backend languages only have one concept of "nothing," and when serialized to JSON, it becomes &lt;code&gt;null&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Java / Kotlin:&lt;/strong&gt; &lt;code&gt;null&lt;/code&gt; serializes to JSON &lt;code&gt;null&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python:&lt;/strong&gt; &lt;code&gt;None&lt;/code&gt; serializes to JSON &lt;code&gt;null&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rust:&lt;/strong&gt; &lt;code&gt;Option::None&lt;/code&gt; (via &lt;code&gt;serde_json&lt;/code&gt;) serializes to JSON &lt;code&gt;null&lt;/code&gt; by default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your backend engineers aren't trying to ruin your TypeScript types. Their runtime literally has no &lt;code&gt;undefined&lt;/code&gt; primitive to send you.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. GraphQL
&lt;/h3&gt;

&lt;p&gt;GraphQL schemas are built around &lt;code&gt;null&lt;/code&gt;. Any nullable field in a GraphQL query returns &lt;code&gt;null&lt;/code&gt; when absent, never an omitted key or &lt;code&gt;undefined&lt;/code&gt;. If you run GraphQL Code Generator straight into your UI components without transforming the output, &lt;code&gt;T | null&lt;/code&gt; will immediately infect every prop and hook in your frontend.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Binary and schema formats: Apache Avro vs. Protobuf
&lt;/h3&gt;

&lt;p&gt;If you work with event-driven architectures or strict RPC contracts (like the monorepo I mentioned at the start), serialization formats dictate how absence is represented on the wire:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Apache Avro:&lt;/strong&gt; Avro has no concept of &lt;code&gt;undefined&lt;/code&gt; or implicit optionality. Nullable fields are modeled explicitly as union types in the schema, like &lt;code&gt;["null", "string"]&lt;/code&gt;, so missing values are serialized directly as &lt;code&gt;null&lt;/code&gt;. If you consume generated Avro TypeScript types directly in your React state, &lt;code&gt;null&lt;/code&gt; is baked into every single field.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protobuf (proto3):&lt;/strong&gt; Protobuf takes a different approach. Historically, proto3 used zero-value defaults (&lt;code&gt;""&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt;) for missing fields. With modern optional field presence and TypeScript generators like &lt;code&gt;@bufbuild/protobuf&lt;/code&gt;, unset optional fields map much more naturally to &lt;code&gt;undefined&lt;/code&gt;, which avoids the &lt;code&gt;null&lt;/code&gt; flood you get with Avro or GraphQL.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Fix: Push the null Boundary to the Backend Serialization Layer
&lt;/h2&gt;

&lt;p&gt;You cannot stop Apache Avro, Protobuf, or a relational database from speaking &lt;code&gt;null&lt;/code&gt;. What you can do is keep that translation strictly in the backend serialization layer, allowing your entire frontend to stay 100% &lt;code&gt;null&lt;/code&gt;-free, even at its network boundary.&lt;/p&gt;

&lt;p&gt;Instead of forcing every frontend developer to remember when to convert &lt;code&gt;undefined&lt;/code&gt; or &lt;code&gt;""&lt;/code&gt; into &lt;code&gt;null&lt;/code&gt;, the backend (or BFF) owns the contract.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Frontend: 100% null-free, even over the wire
&lt;/h3&gt;

&lt;p&gt;When your API contract uses &lt;code&gt;undefined&lt;/code&gt; (omitted keys) or empty strings for missing values, the frontend never touches &lt;code&gt;null&lt;/code&gt;: not in form state, not in React components, and not in outgoing &lt;code&gt;fetch&lt;/code&gt; payloads:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Frontend form &amp;amp; API payload: zero nulls anywhere&lt;/span&gt;
&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;UpdateUserRequest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;nickname&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// omitted if untouched&lt;/span&gt;
  &lt;span class="n"&gt;bio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "" if cleared&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/users/123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;nickname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nickname&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;bio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Backend: translate &lt;code&gt;undefined&lt;/code&gt; ↔ &lt;code&gt;null&lt;/code&gt; at the Avro / Protobuf edge
&lt;/h3&gt;

&lt;p&gt;Your backend domain logic also stays &lt;code&gt;null&lt;/code&gt;-free (&lt;code&gt;undefined&lt;/code&gt; only). Only the thin serializer/deserializer layer converts missing values into &lt;code&gt;null&lt;/code&gt; right before encoding for Avro union schemas (&lt;code&gt;["null", "string"]&lt;/code&gt;) or Protobuf wire contracts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Internal backend domain model (100% null-free)&lt;/span&gt;
&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;UserDomainEvent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;referralCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Generated Avro / Protobuf wire type&lt;/span&gt;
&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;UserWireRecord&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;referralCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Outgoing serializer: explicitly convert missing values -&amp;gt; null for Avro/Protobuf&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toWireRecord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UserDomainEvent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UserWireRecord&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;referralCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;referralCode&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Incoming deserializer: strip wire nulls -&amp;gt; undefined immediately on arrival&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fromWireRecord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UserWireRecord&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UserDomainEvent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;referralCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;referralCode&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What About Translating at the UI Boundary Instead?
&lt;/h2&gt;

&lt;p&gt;You can put a &lt;code&gt;null&lt;/code&gt; ↔ &lt;code&gt;undefined&lt;/code&gt; mapper (using Zod &lt;code&gt;.nullable().transform()&lt;/code&gt; or API adapters) at your frontend's network layer. If you consume a third-party GraphQL or external REST API that you don't control, you have to.&lt;/p&gt;

&lt;p&gt;However, in a fullstack monorepo where you own the backend, doing it in the UI is less ideal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It blurs the rule for frontend developers.&lt;/strong&gt; Instead of a blanket "zero nulls in frontend code" rule, developers have to remember which folders allow &lt;code&gt;null&lt;/code&gt; and which don't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It duplicates translation work.&lt;/strong&gt; Multiple frontend views or clients end up mapping the same &lt;code&gt;null&lt;/code&gt; payloads that a single backend serializer could have normalized once at the source.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Enforce It with a Lint Rule So Nobody Has to Argue in PRs
&lt;/h2&gt;

&lt;p&gt;In a large monorepo, style guides get ignored. Automate the rule instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable &lt;code&gt;strictNullChecks: true&lt;/code&gt; (and ideally &lt;code&gt;exactOptionalPropertyTypes: true&lt;/code&gt;) in &lt;code&gt;tsconfig.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Turn on &lt;a href="https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-null.md" rel="noopener noreferrer"&gt;&lt;code&gt;unicorn/no-null&lt;/code&gt;&lt;/a&gt; across your frontend &lt;code&gt;src/&lt;/code&gt; folders, and only disable it inside your &lt;code&gt;api/&lt;/code&gt;, &lt;code&gt;serializers/&lt;/code&gt;, or &lt;code&gt;mappers/&lt;/code&gt; directories.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;We are still right in the middle of untangling those 33,000+ &lt;code&gt;@ts-expect-error&lt;/code&gt; suppressions. Honestly, the biggest win so far hasn't been burning down the old backlog. It has been stopping the bleeding in new code.&lt;/p&gt;

&lt;p&gt;When 50+ developers share a monorepo, "just be careful with &lt;code&gt;null&lt;/code&gt;" is not a strategy. Establishing a hard architectural border changed the conversation overnight:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inside TypeScript:&lt;/strong&gt; &lt;code&gt;undefined&lt;/code&gt; is our single source of truth (using &lt;code&gt;prop: T | undefined&lt;/code&gt; when we want explicit intent, and &lt;code&gt;""&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt; in form state).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;At the edges:&lt;/strong&gt; &lt;code&gt;null&lt;/code&gt; is strictly a wire-format concern, translated immediately at our Avro, GraphQL, and REST boundaries before it ever touches a component.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In CI:&lt;/strong&gt; ESLint enforces the rule automatically, so nobody has to argue about it in PR reviews.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your codebase feels like a minefield of &lt;code&gt;T | null | undefined&lt;/code&gt;, stop treating &lt;code&gt;null&lt;/code&gt; vs. &lt;code&gt;undefined&lt;/code&gt; as a stylistic preference. Treat it as an architectural boundary problem: ban &lt;code&gt;null&lt;/code&gt; inside your app, normalize it at the edges, and let the compiler do its job.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Where throw Is Safe in TypeScript (And Where It Will Crash Your App)</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 15 Nov 2026 13:45:15 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/where-throw-is-safe-in-typescript-and-where-it-will-crash-your-app-16h2</link>
      <guid>https://dev.to/vladimirivanov/where-throw-is-safe-in-typescript-and-where-it-will-crash-your-app-16h2</guid>
      <description>&lt;p&gt;If you spend enough time reading TypeScript articles, you will notice two loud, opposing camps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;"Never &lt;code&gt;throw&lt;/code&gt;—use &lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;/code&gt; for everything!"&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;"Just &lt;code&gt;throw&lt;/code&gt; and let your Error Boundary or middleware catch it!"&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The truth is that &lt;strong&gt;both camps are right—depending on the runtime construct you are inside and whether you are writing a library or an application.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Know your construct:&lt;/strong&gt; &lt;code&gt;throw&lt;/code&gt; is safely captured inside &lt;code&gt;async&lt;/code&gt; functions, &lt;code&gt;async function*&lt;/code&gt; generators, and RxJS
Observables. In unsafe constructs (Sync Generators, Signals, Timers, Event Listeners), &lt;strong&gt;catch everything inside or never &lt;code&gt;throw&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In &lt;code&gt;async&lt;/code&gt; functions:&lt;/strong&gt; Prefer &lt;code&gt;throw new Error(...)&lt;/code&gt; over &lt;code&gt;return Promise.reject(...)&lt;/code&gt; to avoid extra Promise allocations and forgotten-&lt;code&gt;return&lt;/code&gt; bugs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Libraries vs. Apps:&lt;/strong&gt; Libraries should return typed errors (&lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;/code&gt; or &lt;code&gt;T | SubError&lt;/code&gt;) for expected failures, while applications can safely &lt;code&gt;throw&lt;/code&gt; into centralized boundaries they control.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  1. The Golden Rule: Capturing vs. Non-Capturing Constructs
&lt;/h2&gt;

&lt;p&gt;Before deciding &lt;em&gt;whether&lt;/em&gt; to throw, you need to know how your runtime construct handles an exception. Every construct in&lt;br&gt;
TypeScript falls into one of two buckets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Safe Constructs (Captures &lt;code&gt;throw&lt;/code&gt;):&lt;/strong&gt; The construct has a built-in error or rejection channel that catches &lt;code&gt;throw&lt;/code&gt;
and routes it safely to a handler.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unsafe Constructs (Does NOT Capture &lt;code&gt;throw&lt;/code&gt;):&lt;/strong&gt; There is no error channel. Your rule here must be &lt;strong&gt;either catch everything inside the boundary, or never &lt;code&gt;throw&lt;/code&gt; inside it at all.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Master Cheat Sheet
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Construct&lt;/th&gt;
&lt;th&gt;Captures &lt;code&gt;throw&lt;/code&gt; Safely?&lt;/th&gt;
&lt;th&gt;Where the Error Goes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;async&lt;/code&gt; / &lt;code&gt;Promise&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Promise rejection branch (&lt;code&gt;.catch()&lt;/code&gt; / &lt;code&gt;await&lt;/code&gt; in &lt;code&gt;try/catch&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Async Generator (&lt;code&gt;async function*&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Rejected &lt;code&gt;.next()&lt;/code&gt; Promise (&lt;code&gt;try/catch&lt;/code&gt; around &lt;code&gt;for await...of&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;RxJS Observable&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Stream &lt;code&gt;error&lt;/code&gt; channel (&lt;code&gt;catchError&lt;/code&gt; / &lt;code&gt;subscribe({ error })&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;Promise.allSettled()&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Captured per item as &lt;code&gt;{ status: "rejected", reason }&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sync Generator (&lt;code&gt;function*&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Crashes &lt;code&gt;.next()&lt;/code&gt; synchronously&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Signals (&lt;code&gt;computed()&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cached and crashes synchronously whenever read&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Event Listeners / &lt;code&gt;setTimeout&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Uncaught global error / &lt;code&gt;UnhandledPromiseRejection&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;.forEach(async () =&amp;gt; ...)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Floating rejected Promises (bypasses outer &lt;code&gt;try/catch&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  2. Where &lt;code&gt;throw&lt;/code&gt; Is Safe (Part of the Contract)
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;async&lt;/code&gt; Functions: Prefer &lt;code&gt;throw&lt;/code&gt; Over &lt;code&gt;return Promise.reject()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When rejecting inside an &lt;code&gt;async&lt;/code&gt; function, prefer &lt;code&gt;throw new Error(...)&lt;/code&gt; over &lt;code&gt;return Promise.reject(...)&lt;/code&gt;. Because an&lt;br&gt;
&lt;code&gt;async&lt;/code&gt; function already wraps its return value in a Promise, returning &lt;code&gt;Promise.reject(...)&lt;/code&gt; creates a second,&lt;br&gt;
unnecessary Promise object that JavaScript just has to unwrap and forward to the outer one. Using &lt;code&gt;throw&lt;/code&gt; rejects the&lt;br&gt;
outer Promise directly, avoiding extra memory allocation, preventing bugs from a forgotten &lt;code&gt;return&lt;/code&gt; keyword, and giving&lt;br&gt;
TypeScript clearer control-flow analysis so it knows code after the error is unreachable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Creates an unnecessary extra Promise—and forgetting `return` causes a floating rejection bug!&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserBad&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"User ID is required"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Rejects the outer Promise directly and narrows control flow cleanly&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserGood&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"User ID is required"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Async Generators (&lt;code&gt;async function*&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;In an async generator, every &lt;code&gt;.next()&lt;/code&gt; call returns a &lt;code&gt;Promise&lt;/code&gt;. Because of that, &lt;code&gt;throw&lt;/code&gt; is automatically captured as a&lt;br&gt;
rejected Promise for that iteration step—meaning a standard &lt;code&gt;try/catch&lt;/code&gt; around &lt;code&gt;for await...of&lt;/code&gt; catches it safely, and&lt;br&gt;
any &lt;code&gt;finally&lt;/code&gt; block inside the generator still runs for cleanup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;streamPages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;totalPages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AsyncGenerator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;unknown&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;totalPages&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c1"&gt;// Safe: captured as a rejected Promise for the current iteration step&lt;/span&gt;
                &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Failed to fetch page 3"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="sb"&gt;`Data from page ${page}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Cleaning up async stream connection..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;runStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nf"&gt;streamPages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Caught async generator error:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  RxJS Observables
&lt;/h3&gt;

&lt;p&gt;In reactive streams like &lt;strong&gt;RxJS&lt;/strong&gt;, &lt;code&gt;throw&lt;/code&gt; is completely safe inside operators because the Observable contract defines&lt;br&gt;
three explicit channels: &lt;code&gt;next&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, and &lt;code&gt;complete&lt;/code&gt;. Throwing inside &lt;code&gt;map&lt;/code&gt; or &lt;code&gt;switchMap&lt;/code&gt; routes the error straight&lt;br&gt;
to &lt;code&gt;catchError&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;catchError&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"rxjs"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"valid-json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"{invalid-json}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Safe to throw—routed to the error channel&lt;/span&gt;
        &lt;span class="nf"&gt;catchError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Unknown parse error"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Stream caught error safely:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;fallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Recover and keep stream alive&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Received:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Where Never to Leave &lt;code&gt;throw&lt;/code&gt; Uncaught (Unsafe Constructs)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Sync Generators (&lt;code&gt;function*&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Unlike an async generator, a &lt;strong&gt;sync generator has no rejection branch&lt;/strong&gt;. When it hits &lt;code&gt;throw&lt;/code&gt;, &lt;code&gt;.next()&lt;/code&gt; does not return&lt;br&gt;
&lt;code&gt;{ value, done }&lt;/code&gt;—it immediately crashes synchronously at the call site with zero TypeScript warning.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;readLines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Generator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;unknown&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"CORRUPT"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Encountered corrupt line"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// No reject branch!&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;syncGen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;readLines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"CORRUPT"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;syncGen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 💥 Crashes synchronously immediately (no .catch() exists)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Signals (&lt;code&gt;computed()&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Signals (in Angular, Solid, Preact, or the TC39 Signals proposal) represent &lt;strong&gt;synchronous reactive state&lt;/strong&gt;, not async&lt;br&gt;
streams. They have no &lt;code&gt;.catch()&lt;/code&gt; or &lt;code&gt;error&lt;/code&gt; channel:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If a &lt;code&gt;computed()&lt;/code&gt; signal throws, it caches the error and &lt;strong&gt;re-throws synchronously&lt;/strong&gt; every time a component or
&lt;code&gt;effect()&lt;/code&gt; reads it.&lt;/li&gt;
&lt;li&gt;Instead of throwing inside a signal, catch expected failures and return a typed state union:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ UNSAFE: Reading `parsedUser()` later crashes synchronously wherever it is read&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;parsedUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;rawUserSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ SAFE: Model the error state explicitly in TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;UserState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ready"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;safeUserState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;computed&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;UserState&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ready"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;rawUserSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Invalid JSON"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Event Listeners, Timers, and &lt;code&gt;.forEach(async ...)&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Event Listeners &amp;amp; &lt;code&gt;setTimeout&lt;/code&gt;:&lt;/strong&gt; Callbacks run on a separate tick of the event loop with an empty call stack. An
outer &lt;code&gt;try/catch&lt;/code&gt; around &lt;code&gt;setTimeout&lt;/code&gt; or &lt;code&gt;addEventListener&lt;/code&gt; will never catch a &lt;code&gt;throw&lt;/code&gt; inside the callback. Always
wrap the callback body itself in &lt;code&gt;try/catch&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.forEach(async () =&amp;gt; ...)&lt;/code&gt;:&lt;/strong&gt; &lt;code&gt;.forEach()&lt;/code&gt; ignores returned Promises. If an &lt;code&gt;async&lt;/code&gt; callback throws inside
&lt;code&gt;.forEach()&lt;/code&gt;, it creates a floating &lt;code&gt;UnhandledPromiseRejection&lt;/code&gt;. Use &lt;code&gt;for...of&lt;/code&gt; (sequential) or
&lt;code&gt;await Promise.all(items.map(...))&lt;/code&gt; (parallel) inside a &lt;code&gt;try/catch&lt;/code&gt; instead.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  4. TypeScript’s Blind Spot: Invisible Exceptions
&lt;/h2&gt;

&lt;p&gt;If you come from a language like &lt;strong&gt;Java&lt;/strong&gt;, one of the most frustrating parts of TypeScript is that &lt;strong&gt;function signatures&lt;br&gt;
don't tell you if a function can &lt;code&gt;throw&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In Java, checked exceptions (&lt;code&gt;throws IOException&lt;/code&gt;) force the compiler to warn callers to either handle the error or declare that they re-throw it. In TypeScript, a function that crashes half the time looks identical to one that never fails:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ValidationError&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ValidationError"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * Parses a raw JSON string into a User object.
 * @throws {ValidationError} When the user ID is missing.
 * @throws {SyntaxError} When the input is invalid JSON.
 */&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;parseUserSafe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ValidationError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing user ID"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// At the call site: catch what you expect, re-throw everything else&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseUserSafe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawInput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nc"&gt;ValidationError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Invalid user payload:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Re-throw unexpected bugs&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Capture External Exceptions Immediately
&lt;/h3&gt;

&lt;p&gt;Whenever you call untrusted or external APIs (&lt;code&gt;JSON.parse()&lt;/code&gt;, &lt;code&gt;fetch()&lt;/code&gt;, third-party SDKs), &lt;strong&gt;catch immediately at the&lt;br&gt;
boundary&lt;/strong&gt; and translate raw exceptions into your own typed domain error (&lt;code&gt;SubError&lt;/code&gt;) or &lt;code&gt;Result&lt;/code&gt;. Once errors are&lt;br&gt;
well-typed inside your app, let them bubble up to your centralized recovery boundary rather than wrapping every single&lt;br&gt;
function in noisy &lt;code&gt;try/catch&lt;/code&gt; blocks.&lt;/p&gt;


&lt;h2&gt;
  
  
  5. Library vs. Application Code: Who Owns the Boundary?
&lt;/h2&gt;

&lt;p&gt;This is where the "never throw" vs. "just throw" debate finally makes sense. The rule depends on &lt;strong&gt;which side of the boundary you are writing&lt;/strong&gt;:&lt;/p&gt;
&lt;h3&gt;
  
  
  In Library Code: Strong Type Contracts, Never Surprise &lt;code&gt;throw&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When you publish a library or shared internal package, the consumer only sees your &lt;code&gt;.d.ts&lt;/code&gt; types. Because TypeScript cannot encode &lt;code&gt;throws&lt;/code&gt; in a function signature, throwing for &lt;strong&gt;operational errors&lt;/strong&gt; (invalid input, expired tokens, network failures) sets a hidden trap for the caller.&lt;/p&gt;

&lt;p&gt;Instead, encode expected failures directly in the return type:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pattern&lt;/th&gt;
&lt;th&gt;Signature Example&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;th&gt;Main Trade-off&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;`{ ok: true, value: T } \&lt;/td&gt;
&lt;td&gt;{ ok: false, error: E }`&lt;/td&gt;
&lt;td&gt;Generic libraries &amp;amp; complex domain logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;**`T \&lt;/td&gt;
&lt;td&gt;SubError`**&lt;/td&gt;
&lt;td&gt;`User \&lt;/td&gt;
&lt;td&gt;AuthError`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Go Tuple&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;`[T, null] \&lt;/td&gt;
&lt;td&gt;[null, E]`&lt;/td&gt;
&lt;td&gt;Flat &lt;code&gt;async/await&lt;/code&gt; flows without &lt;code&gt;try/catch&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;**&lt;code&gt;Option&lt;/code&gt; (`T \&lt;/td&gt;
&lt;td&gt;null`)**&lt;/td&gt;
&lt;td&gt;`User \&lt;/td&gt;
&lt;td&gt;null`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Effect (&lt;code&gt;Effect&amp;lt;A, E&amp;gt;&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Effect&amp;lt;User, AuthError&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Large enterprise apps wanting Java-style typed errors&lt;/td&gt;
&lt;td&gt;High learning curve; replaces standard &lt;code&gt;async/await&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  Example: Returning &lt;code&gt;T | SubError&lt;/code&gt; in a Library
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AuthError&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"EXPIRED"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"INVALID"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AuthError"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Library contract: explicitly tells TypeScript callers this can fail with AuthError&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;verifyToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;AuthError&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AuthError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Token is missing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"INVALID"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Returned, NOT thrown!&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Alice"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Application consumer: TypeScript forces the check before using `user`&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;verifyToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nc"&gt;AuthError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// App developer chooses whether to recover locally or throw to ErrorBoundary!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ✅ Narrowed to `User`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Operational Errors vs. Programmer Bugs (Invariant Violations)
&lt;/h3&gt;

&lt;p&gt;In library design, separate &lt;strong&gt;operational errors&lt;/strong&gt; from &lt;strong&gt;programmer bugs&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Operational Errors (Expected Failures):&lt;/strong&gt; Invalid user input, expired tokens, or network timeouts. &lt;strong&gt;Never &lt;code&gt;throw&lt;/code&gt;in a library&lt;/strong&gt;—return &lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;/code&gt; or &lt;code&gt;T | SubError&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Programmer Bugs (Invariant Violations):&lt;/strong&gt; Impossible states caused by a developer wiring up your API incorrectly (e.g., calling &lt;code&gt;db.query()&lt;/code&gt; before &lt;code&gt;db.connect()&lt;/code&gt;). Throwing loudly (in both dev and prod) surfaces the setup bug immediately and keeps your happy-path return types clean.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Special Case: React Hooks (Why Throwing Traps Consumers)
&lt;/h3&gt;

&lt;p&gt;React Hooks introduce a unique catch: &lt;strong&gt;you cannot wrap a hook call in a &lt;code&gt;try/catch&lt;/code&gt; block&lt;/strong&gt; without violating the Rules of Hooks. If a library hook throws when &lt;code&gt;&amp;lt;AuthProvider&amp;gt;&lt;/code&gt; is missing, a shared component (like a &lt;code&gt;&amp;lt;Navbar /&amp;gt;&lt;/code&gt; rendered onboth public and authenticated pages) cannot recover inline.&lt;/p&gt;

&lt;p&gt;The cleanest library pattern is to expose &lt;strong&gt;both&lt;/strong&gt; a non-throwing base hook and a strict convenience hook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 1. Safe base hook: never throws, letting shared components recover inline&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;useOptionalAuth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AuthContextValue&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;useContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;AuthContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// 2. Strict convenience hook: throws for protected routes where auth is guaranteed&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;useAuth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AuthContextValue&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useOptionalAuth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"useAuth must be used within an &amp;lt;AuthProvider&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  In Application Code: You Own the Boundaries, So &lt;code&gt;throw&lt;/code&gt; Is Safe
&lt;/h3&gt;

&lt;p&gt;In an application, &lt;strong&gt;you control both the call site and the top-level recovery boundary&lt;/strong&gt;—such as a React &lt;code&gt;ErrorBoundary&lt;/code&gt;, Next.js &lt;code&gt;error.tsx&lt;/code&gt;, or global Express/Fastify error middleware. Letting &lt;code&gt;async&lt;/code&gt; service calls or strict hooks &lt;code&gt;throw&lt;/code&gt; directly into boundaries you own eliminates &lt;code&gt;if (!res.ok)&lt;/code&gt; boilerplate across dozens of intermediate components.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Bonus: What’s Next? TC39 &lt;code&gt;throw&lt;/code&gt; Expressions
&lt;/h2&gt;

&lt;p&gt;Today in JavaScript and TypeScript, &lt;code&gt;throw&lt;/code&gt; is a &lt;strong&gt;statement&lt;/strong&gt;, not an &lt;strong&gt;expression&lt;/strong&gt;—meaning you cannot use it directly inside nullish coalescing (&lt;code&gt;??&lt;/code&gt;), ternary operators, or concise arrow functions without writing a helper function.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;TC39 &lt;code&gt;throw&lt;/code&gt; Expressions proposal&lt;/strong&gt; (currently at &lt;strong&gt;Stage 2&lt;/strong&gt;) turns &lt;code&gt;throw&lt;/code&gt; into an expression that evaluates to&lt;br&gt;
TypeScript's &lt;code&gt;never&lt;/code&gt; type. Because &lt;code&gt;string | never&lt;/code&gt; simplifies purely to &lt;code&gt;string&lt;/code&gt; in TypeScript, null checks become clean one-liners:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Today's TypeScript workaround: a `never`-returning helper function&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;raise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;never&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;API_KEY&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nf"&gt;raise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing API_KEY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Narrowed to `string`&lt;/span&gt;

&lt;span class="c1"&gt;// Future (Stage 2 Proposal): Native `throw` expression&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;apiKeyFuture&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;API_KEY&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing API_KEY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Summary: 4 Rules to Take With You
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Know your construct:&lt;/strong&gt; &lt;code&gt;throw&lt;/code&gt; safely inside &lt;code&gt;async&lt;/code&gt; functions, &lt;code&gt;async function*&lt;/code&gt;, and RxJS Observables. In unsafe constructs (Sync Generators, Signals, Timers, Event Listeners), &lt;strong&gt;catch all or never throw&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In &lt;code&gt;async&lt;/code&gt; functions, prefer &lt;code&gt;throw&lt;/code&gt; over &lt;code&gt;return Promise.reject()&lt;/code&gt;&lt;/strong&gt; to avoid extra Promise allocations and forgotten-&lt;code&gt;return&lt;/code&gt; bugs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Catch external exceptions at the edge&lt;/strong&gt; and translate them into typed errors (&lt;code&gt;Result&lt;/code&gt; or &lt;code&gt;T | SubError&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Libraries return errors; apps throw into boundaries:&lt;/strong&gt; Keep library contracts explicit in TypeScript types, and save &lt;code&gt;throw&lt;/code&gt; for application boundaries you control.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Where do you draw the line between &lt;code&gt;throw&lt;/code&gt; and &lt;code&gt;Result&lt;/code&gt; types in your TypeScript projects? Drop your take in the&lt;br&gt;
comments!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Your Trade Is on the Wrong Day: It’s a Type Error, Not a Timezone Bug</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 25 Oct 2026 13:54:41 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/your-trade-is-on-the-wrong-day-its-a-type-error-not-a-timezone-bug-2nbm</link>
      <guid>https://dev.to/vladimirivanov/your-trade-is-on-the-wrong-day-its-a-type-error-not-a-timezone-bug-2nbm</guid>
      <description>&lt;p&gt;A trade executes at 23:47 UTC. A user in New York sees 19:47; a user in Tokyo sees 08:47 the next day.&lt;/p&gt;

&lt;p&gt;Both displays can be right. Trouble starts when the application uses the viewer’s local date to decide which trading day gets the trade.&lt;/p&gt;

&lt;p&gt;That’s often called a timezone bug. The deeper problem is using one kind of value—a timestamp—to represent several different things: an event, a calendar date, or a scheduled local time.&lt;/p&gt;

&lt;p&gt;JavaScript’s &lt;code&gt;Temporal&lt;/code&gt; API gives these values distinct types. The examples below use it to make the differences explicit. Temporal support varies by runtime; use a compatible polyfill where needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick decision tree
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What are you storing?
│
├─ A specific event: “When did the fill happen?”  → Instant
├─ A scheduled local time: “09:30 New York”       → ZonedDateTime
├─ A calendar date only: settlement or expiry     → PlainDate
├─ A recurring month and day: coupon on Dec 15    → PlainMonthDay
└─ A length of time: timeout or elapsed period    → Duration
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sections below explain each choice and show how it applies to trading systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose the type that matches the meaning
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Temporal type&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A specific moment, such as a fill or log event&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.Instant&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2026-10-26T10:59:05Z&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A wall-clock time in a named timezone&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.ZonedDateTime&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;08:00 in &lt;code&gt;Europe/London&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A calendar date without a time or timezone&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.PlainDate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Settlement date: &lt;code&gt;2026-10-28&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A recurring month and day&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.PlainMonthDay&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Coupon date: December 15&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A length of time&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.Duration&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A 30-minute timeout&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A useful question is: &lt;strong&gt;Would this value mean something different if the viewer changed timezone?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An event’s &lt;code&gt;Instant&lt;/code&gt; does not change, though its displayed local time does. A &lt;code&gt;PlainDate&lt;/code&gt; stays the same date. A scheduled time such as “08:00 London” depends on its named timezone, including its daylight-saving rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Send the right value over the wire
&lt;/h2&gt;

&lt;p&gt;Don’t convert every date or time to UTC before sending it. UTC is suitable for an &lt;code&gt;Instant&lt;/code&gt;, but it can lose the meaning of a calendar date or a future local schedule.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"executed_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-10-26T10:59:05Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"settlement_date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-10-28"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scheduled_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"local"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-10-26T08:00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"time_zone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Europe/London"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store an event timestamp as an instant. Store a date-only value as a date. For a future schedule tied to local time, keep the local date and time with an IANA timezone ID.&lt;/p&gt;

&lt;h2&gt;
  
  
  Front office: events and sessions
&lt;/h2&gt;

&lt;p&gt;An exchange fill is an instant. Convert it to a date only after choosing which timezone defines the relevant trading day.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fill&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Instant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-10-26T23:47:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// If the report defines its day in UTC:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;utcDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toZonedDateTimeISO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;UTC&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toPlainDate&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// If the business rule defines its day in New York:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newYorkDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fill&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toZonedDateTimeISO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;America/New_York&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toPlainDate&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Those dates may differ. The correct one depends on the reporting rule—not on the timezone of whoever opened the page.&lt;/p&gt;

&lt;p&gt;Avoid using &lt;code&gt;new Date(timestamp).getDate()&lt;/code&gt; for a business date. &lt;code&gt;getDate()&lt;/code&gt; uses the computer’s local timezone, so different users can get different answers.&lt;/p&gt;

&lt;p&gt;A session opening such as “09:30 New York time” is a local schedule in a named zone. Don’t hardcode its UTC offset: New York alternates between standard time and daylight time, and timezone rules can change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sessionOpen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ZonedDateTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;year&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;month&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;America/New_York&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fillTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Instant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-11-02T14:45:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isAfterOpen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Instant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fillTime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sessionOpen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toInstant&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For recurring schedules, store the local time and timezone, then resolve the actual instant for each occurrence. For production scheduling, define how to handle local times that are ambiguous or nonexistent during daylight-saving transitions.&lt;/p&gt;

&lt;p&gt;FX rollover conventions are often described using a New York wall-clock time, but the applicable convention can depend on the product and institution. Treat it as configured business data rather than assuming one UTC hour works year-round.&lt;/p&gt;

&lt;h2&gt;
  
  
  Back office: settlement and expiry
&lt;/h2&gt;

&lt;p&gt;Settlement is a calendar calculation, not “add 48 hours to the fill.” It usually requires a market-specific business calendar that accounts for weekends and holidays.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;addBusinessDays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;holidays&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;remaining&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;remaining&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;days&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isWeekday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dayOfWeek&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isHoliday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;holidays&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isWeekday&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isHoliday&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;remaining&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tradeDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PlainDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-10-30&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;holidays&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-11-02&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;settlementDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;addBusinessDays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tradeDate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;holidays&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;settlementDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a simplified example: real settlement rules may depend on the instrument, currency, and relevant market calendars.&lt;/p&gt;

&lt;p&gt;An option’s expiry date is also a calendar date. The last trading date may be different, and time-to-expiry for pricing should follow the conventions of the pricing model. Don’t substitute a rough millisecond calculation for those rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Crypto: UTC days and timestamp units
&lt;/h2&gt;

&lt;p&gt;Crypto trades continuously, but reports still need a defined daily boundary. If the report uses UTC days, derive the bucket date in UTC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;trade&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Instant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-10-26T23:47:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;utcDay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;trade&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toZonedDateTimeISO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;UTC&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toPlainDate&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;utcDay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// "2026-10-26"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another common integration bug is confusing seconds with milliseconds. Temporal has &lt;code&gt;fromEpochMilliseconds()&lt;/code&gt;, but no &lt;code&gt;fromEpochSeconds()&lt;/code&gt;. Convert seconds explicitly at the API boundary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timestampSeconds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;_730_000_000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;instant&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Instant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromEpochMilliseconds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;timestampSeconds&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Normalize timestamps once when data enters your system, and keep the original unit clear in the adapter. Don’t pass a raw number to a date API without knowing whether it represents seconds, milliseconds, or another unit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tax lots: keep the questions separate
&lt;/h2&gt;

&lt;p&gt;A fill instant records exactly when an execution happened. A &lt;code&gt;PlainDate&lt;/code&gt; can represent a date used by a report or a user interface. Those values answer different questions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fillAt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Instant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2025-03-15T23:47:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reportedPurchaseDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PlainDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2025-03-15&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fillAt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reportedPurchaseDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which date or timestamp governs a tax calculation depends on the relevant rules and jurisdiction. Don’t assume that a user-entered calendar date overrides the execution timestamp.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same idea in Java, .NET, and JavaScript
&lt;/h2&gt;

&lt;p&gt;These ecosystems make similar distinctions, but their APIs do not match one-to-one.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Java&lt;/th&gt;
&lt;th&gt;.NET&lt;/th&gt;
&lt;th&gt;JavaScript&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Exact moment&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Instant&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;DateTimeOffset&lt;/code&gt; (or UTC &lt;code&gt;DateTime&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Temporal.Instant&lt;/code&gt;; traditionally &lt;code&gt;Date&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date only&lt;/td&gt;
&lt;td&gt;&lt;code&gt;LocalDate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DateOnly&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Temporal.PlainDate&lt;/code&gt;; traditionally a convention around &lt;code&gt;Date&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time only&lt;/td&gt;
&lt;td&gt;&lt;code&gt;LocalTime&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;TimeOnly&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.PlainTime&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date and time without a zone&lt;/td&gt;
&lt;td&gt;&lt;code&gt;LocalDateTime&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;DateTime&lt;/code&gt; with &lt;code&gt;Kind.Unspecified&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.PlainDateTime&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date and time in a named zone&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ZonedDateTime&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Local date/time plus &lt;code&gt;TimeZoneInfo&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.ZonedDateTime&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Elapsed time&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Duration&lt;/code&gt; or &lt;code&gt;Period&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;TimeSpan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Temporal.Duration&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Java has had the &lt;code&gt;java.time&lt;/code&gt; API since Java 8. Joda-Time is a separate older library whose design helped establish this style of distinct date and time types. For new Java code, &lt;code&gt;java.time&lt;/code&gt; is generally the standard choice. &lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/datetime/choosing-between-datetime" rel="noopener noreferrer"&gt;.NET date and time types&lt;/a&gt; · &lt;a href="https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/time/package-summary.html" rel="noopener noreferrer"&gt;Java &lt;code&gt;java.time&lt;/code&gt;&lt;/a&gt; · &lt;a href="https://www.joda.org/joda-time/" rel="noopener noreferrer"&gt;Joda-Time&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In .NET, &lt;code&gt;DateOnly&lt;/code&gt;, &lt;code&gt;TimeOnly&lt;/code&gt;, &lt;code&gt;DateTimeOffset&lt;/code&gt;, &lt;code&gt;TimeSpan&lt;/code&gt;, and &lt;code&gt;TimeZoneInfo&lt;/code&gt; cover related needs. A &lt;code&gt;DateTimeOffset&lt;/code&gt; carries an offset, but an offset alone does not preserve a named zone’s daylight-saving rules. Keep the zone ID when future local schedules depend on those rules. &lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/datetime/" rel="noopener noreferrer"&gt;.NET date and time guidance&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Where date-fns fits
&lt;/h3&gt;

&lt;p&gt;If your project already uses &lt;code&gt;Date&lt;/code&gt;, date-fns provides convenient functions for operations such as adding days, comparing dates, and formatting. With date-fns v4, timezone-aware calculations can use &lt;code&gt;@date-fns/tz&lt;/code&gt; and an explicit timezone context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;isSameDay&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;date-fns&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;tz&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@date-fns/tz&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sameNewYorkDay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;isSameDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-10-26T23:30:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-10-27T01:00:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;in&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;tz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;America/New_York&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The timezone context tells date-fns which local calendar day to use for the comparison. For older date-fns versions, timezone support is commonly provided by the separate &lt;code&gt;date-fns-tz&lt;/code&gt; package. Check the version and package documentation for your project. &lt;a href="https://github.com/date-fns/date-fns/blob/main/pkgs/core/docs/timeZones.md" rel="noopener noreferrer"&gt;date-fns timezone support&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Date-fns is useful when you want a function-based toolkit around &lt;code&gt;Date&lt;/code&gt;. Temporal’s main advantage is that its types express the difference between an instant, a date, and a zoned schedule directly. Neither library chooses the business rule for you: your application still has to decide which timezone defines a trading day or settlement date.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The same distinction appears across languages, even though the type names and APIs differ:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Event happened at a moment:&lt;/strong&gt; Java &lt;code&gt;Instant&lt;/code&gt;, JavaScript &lt;code&gt;Temporal.Instant&lt;/code&gt;, or .NET &lt;code&gt;DateTimeOffset&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calendar date with no time:&lt;/strong&gt; Java &lt;code&gt;LocalDate&lt;/code&gt;, JavaScript &lt;code&gt;Temporal.PlainDate&lt;/code&gt;, or .NET &lt;code&gt;DateOnly&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local schedule in a named timezone:&lt;/strong&gt; Java &lt;code&gt;ZonedDateTime&lt;/code&gt;, JavaScript &lt;code&gt;Temporal.ZonedDateTime&lt;/code&gt;, or .NET local date/time combined with &lt;code&gt;TimeZoneInfo&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elapsed or calendar-based amount:&lt;/strong&gt; Java &lt;code&gt;Duration&lt;/code&gt; or &lt;code&gt;Period&lt;/code&gt;, JavaScript &lt;code&gt;Temporal.Duration&lt;/code&gt;, or .NET &lt;code&gt;TimeSpan&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For existing Java systems that use Joda-Time, keep it where compatibility requires it; for new Java code, prefer &lt;code&gt;java.time&lt;/code&gt;. In JavaScript, date-fns can make &lt;code&gt;Date&lt;/code&gt; operations easier, and date-fns v4 adds timezone-aware operations through &lt;code&gt;@date-fns/tz&lt;/code&gt;. Temporal goes further by giving different date and time meanings distinct types, where supported.&lt;/p&gt;

&lt;p&gt;The portable rule is simple: represent the meaning you have—an instant, a calendar date, a local time, or a zoned schedule—and make conversions explicit. Then apply the business rule that defines the trading day, settlement, or expiry.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>dates</category>
      <category>finance</category>
      <category>debugging</category>
    </item>
    <item>
      <title>AI Found the Architecture Problems Your Team Stopped Seeing</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 14 Jun 2026 09:43:45 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/ai-found-the-architecture-problems-your-team-stopped-seeing-2350</link>
      <guid>https://dev.to/vladimirivanov/ai-found-the-architecture-problems-your-team-stopped-seeing-2350</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5j0qjzes635f60eq52ri.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5j0qjzes635f60eq52ri.png" alt="Six architectural structures colliding into a web of circular dependencies" width="799" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every codebase starts with the same intention:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Let's structure this properly so it stays maintainable."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And then reality happens.&lt;/p&gt;

&lt;p&gt;We don't pick one structure. We pick &lt;em&gt;several&lt;/em&gt;. And that's where most architectural problems begin.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why architecture advice only works in small systems
&lt;/h2&gt;

&lt;p&gt;Most architecture discussions quietly assume something important: a small-to-medium codebase with clear ownership boundaries.&lt;/p&gt;

&lt;p&gt;In that world, layers are easy to enforce, dependencies are visible, structure matches intent, and refactoring is local. So advice like "use feature-based structure" or "follow clean architecture" actually works.&lt;/p&gt;

&lt;p&gt;But that's not the world most long-lived systems live in.&lt;/p&gt;

&lt;p&gt;In a large monorepo, boundaries are softer, ownership is shared, changes are continuous, and multiple architectural styles inevitably coexist. Most importantly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Structure is no longer enforced — it is negotiated.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Feature boundaries overlap domain boundaries. Layers leak across features. Shared utilities become dependency hubs. Events connect everything indirectly. The system is no longer structured in one way. It is structured in &lt;em&gt;several competing ways at once&lt;/em&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The six structures — and where each one breaks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Layer-based (MVC)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/controllers  /services  /models
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Separate code by technical responsibility. It feels clean and familiar — most frameworks push this by default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it breaks:&lt;/strong&gt; Features get scattered across layers. Changes require touching multiple folders. Services become dependency hubs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hidden failure mode: everything depends on everything through the service layer.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  2. Feature-based (vertical slicing)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/orders  /payments  /shipping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Group everything needed for a feature together. Improves local reasoning and reduces navigation overhead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it breaks:&lt;/strong&gt; Shared logic gets duplicated or pushed into "common." Features slowly become mini-monoliths. Cross-feature dependencies emerge anyway.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hidden failure mode: "shared" logic becomes the new service layer.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  3. Domain-based (DDD)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/orders  /pricing  /shipping  /returns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Model the real world — business concepts first. Aligns code with how the business thinks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it breaks:&lt;/strong&gt; Domains are harder to define than expected. Boundaries shift over time. Subdomains start depending on each other.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hidden failure mode: "domain purity" collapses under real change pressure.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  4. Layer + feature hybrid
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/orders/ui  /orders/domain  /orders/infra
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Combine feature isolation with internal layering — the "best of both worlds."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it breaks:&lt;/strong&gt; Complexity is duplicated per feature. Cross-feature duplication increases. Inconsistencies appear between features over time.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hidden failure mode: you scale structure, not understanding.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  5. Component-based (frontend)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/components/Button  /Modal  /Table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Build reusable UI building blocks. Maximises reuse and design consistency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it breaks:&lt;/strong&gt; Business logic leaks into components. Components become over-generalised. State dependencies become tangled.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hidden failure mode: reuse becomes coupling in disguise.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  6. Event-driven / capability-based
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/billing-events  /order-events  /shipping-events
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Structure around events or system capabilities. Decouples systems and enables scalability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it breaks:&lt;/strong&gt; Execution flow is hard to trace. Dependencies hide inside event subscriptions. Debugging requires system-wide reasoning.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hidden failure mode: coupling disappears visually but remains logically.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What happens when you mix them
&lt;/h2&gt;

&lt;p&gt;Most real codebases don't follow one structure. They follow all of them at once:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;features contain layers&lt;/li&gt;
&lt;li&gt;layers contain features&lt;/li&gt;
&lt;li&gt;domains overlap features&lt;/li&gt;
&lt;li&gt;components leak business logic&lt;/li&gt;
&lt;li&gt;events connect everything&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And then we wonder why every change touches something unexpected.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why mixing produces cycles
&lt;/h2&gt;

&lt;p&gt;Circular dependencies are not random. They appear when the feature boundary and the domain boundary disagree about who owns a piece of logic — so both reach for it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Feature A needs logic from Feature B&lt;/li&gt;
&lt;li&gt;B already depends on shared services from A&lt;/li&gt;
&lt;li&gt;Domain boundaries don't match feature boundaries&lt;/li&gt;
&lt;li&gt;Layer boundaries don't match runtime dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So instead of a direction, you get a loop:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpl2436lqyyaw5dlywq6s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpl2436lqyyaw5dlywq6s.png" alt="Cycle diagram: Feature A, Service B, and Domain C forming a circular dependency" width="800" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is not a bug in the code. It's a contradiction in the structure.&lt;/p&gt;




&lt;h2&gt;
  
  
  AI makes it impossible to ignore
&lt;/h2&gt;

&lt;p&gt;AI coding tools don't introduce circular dependencies — they expose them.&lt;/p&gt;

&lt;p&gt;In a well-structured codebase, AI feels almost invisible: it suggests changes within clear boundaries, works inside a single module, rarely needs to cross the system.&lt;/p&gt;

&lt;p&gt;In a poorly structured monorepo, something different happens. A single change pulls in multiple unrelated modules. Refactoring suggestions span half the system. AI has to load far more context than expected.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;AI does not assume architecture — it discovers it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Circular dependencies used to be easy to live with: "it still builds," "we know why it happens," "it's just legacy glue." AI removes that tolerance. Every action becomes a dependency trace — what imports what, what impacts what, what breaks if changed. Circular dependencies stop being abstract warnings. They become visible symptoms of how far the system must travel to answer a simple question.&lt;/p&gt;




&lt;h2&gt;
  
  
  The conclusion
&lt;/h2&gt;

&lt;p&gt;Every structure works — but only when it's consistent.&lt;/p&gt;

&lt;p&gt;The moment you mix models, you stop having architecture and start having &lt;em&gt;accidental connectivity&lt;/em&gt;. That's exactly where circular dependencies come from. Not from bad code. From conflicting ideas about how the code is supposed to be organised.&lt;/p&gt;

&lt;p&gt;And AI is the first tool that makes that contradiction impossible to ignore.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>softwareengineering</category>
      <category>legacy</category>
    </item>
    <item>
      <title>Why Curiosity Is a Better Career Strategy Than Planning</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 31 May 2026 08:11:07 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/why-curiosity-is-a-better-career-strategy-than-planning-nkl</link>
      <guid>https://dev.to/vladimirivanov/why-curiosity-is-a-better-career-strategy-than-planning-nkl</guid>
      <description>&lt;h2&gt;
  
  
  Curiosity Is a Better Compass Than Certainty
&lt;/h2&gt;

&lt;p&gt;I first heard this idea by accident.&lt;/p&gt;

&lt;p&gt;On a flight back from Thailand, someone had left a podcast playing. I pressed play without thinking much about it.&lt;/p&gt;

&lt;p&gt;A professor was talking about innovation in AI, career decisions, and the uncertainty people face after university.&lt;/p&gt;

&lt;p&gt;One idea stayed with me.&lt;/p&gt;

&lt;p&gt;When he had no clear idea what to study or what direction to take, he didn’t try to force a plan. He followed his curiosity.&lt;/p&gt;

&lt;p&gt;That decision ended up shaping his entire career.&lt;/p&gt;

&lt;p&gt;At first, it sounded like simple advice. But the more I thought about it, the more I realised it wasn’t just motivational — it was descriptive.&lt;/p&gt;

&lt;p&gt;Curiosity wasn’t just a feeling. It looked more like a signal inside a system that drives attention, learning, and career direction.&lt;/p&gt;

&lt;p&gt;So I tried to model it.&lt;/p&gt;

&lt;p&gt;What I found was that curiosity is not a single trait. It behaves more like a signal inside a system involving attention, motivation, reward, identity, learning, and feedback loops.&lt;/p&gt;

&lt;p&gt;And once you see it that way, “follow your curiosity” stops being vague advice — and starts looking like a practical strategy for navigating uncertainty.&lt;/p&gt;




&lt;p&gt;After hearing that story, I became interested in a deeper question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does curiosity have such a strong effect on career direction?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Understanding that system helps explain why following curiosity often leads to surprisingly good outcomes.&lt;/p&gt;

&lt;p&gt;Here’s the mental model I ended up with:&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Attention (the upstream bottleneck)
&lt;/h2&gt;

&lt;p&gt;Before curiosity or motivation can matter, there is attention.&lt;/p&gt;

&lt;p&gt;Attention determines what enters awareness in the first place.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Curiosity competes for attention&lt;/li&gt;
&lt;li&gt;Motivation sustains attention&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If attention is overloaded or hijacked, both curiosity and motivation weaken.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Curiosity pulls attention toward uncertainty&lt;/li&gt;
&lt;li&gt;Motivation holds attention on a goal&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Interest (the stabilised form of curiosity)
&lt;/h2&gt;

&lt;p&gt;Interest is what happens when curiosity repeats.&lt;/p&gt;

&lt;p&gt;Curiosity is a spike. Interest is a pattern.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Curiosity: “What is this?”&lt;/li&gt;
&lt;li&gt;Interest: “I keep coming back to this”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Interest matters because it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stabilises exploration&lt;/li&gt;
&lt;li&gt;reduces cognitive friction&lt;/li&gt;
&lt;li&gt;becomes long-term motivational fuel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Curiosity → repeated curiosity → Interest → sustained motivation&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Reward (why motivation persists)
&lt;/h2&gt;

&lt;p&gt;Motivation depends on perceived reward.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;progress signals&lt;/li&gt;
&lt;li&gt;mastery&lt;/li&gt;
&lt;li&gt;external outcomes (money, recognition)&lt;/li&gt;
&lt;li&gt;internal satisfaction (clarity, completion)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Motivation fades when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rewards are delayed&lt;/li&gt;
&lt;li&gt;progress is invisible&lt;/li&gt;
&lt;li&gt;feedback loops are weak&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Motivation is maintained by reward feedback loops, not intentions.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  4. Uncertainty (the trigger for curiosity)
&lt;/h2&gt;

&lt;p&gt;Curiosity cannot exist without uncertainty.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No uncertainty → no curiosity&lt;/li&gt;
&lt;li&gt;Too much uncertainty → avoidance&lt;/li&gt;
&lt;li&gt;Moderate uncertainty → peak curiosity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Curiosity is maximised at &lt;strong&gt;manageable unknowns&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This explains why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;beginners feel overwhelmed&lt;/li&gt;
&lt;li&gt;experts feel bored&lt;/li&gt;
&lt;li&gt;the learning zone sits in between&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Friction (the enemy of action)
&lt;/h2&gt;

&lt;p&gt;Even when curiosity exists, friction can block execution.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;complex setup&lt;/li&gt;
&lt;li&gt;slow feedback loops&lt;/li&gt;
&lt;li&gt;unclear next steps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Often, motivation fails not due to lack of desire, but because:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;the cost of action exceeds perceived reward&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;AI tools reduce friction, which is why they amplify both curiosity and action in practice.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Agency (the belief that action matters)
&lt;/h2&gt;

&lt;p&gt;Agency is the belief that your actions can influence outcomes.&lt;/p&gt;

&lt;p&gt;Without agency:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;curiosity becomes passive consumption&lt;/li&gt;
&lt;li&gt;motivation collapses (“why bother?”)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With agency:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;curiosity becomes exploration&lt;/li&gt;
&lt;li&gt;motivation becomes execution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Engineers often develop strong curiosity loops because systems give immediate feedback between action and result.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Competence (what motivation feeds on)
&lt;/h2&gt;

&lt;p&gt;As competence increases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;uncertainty becomes structured&lt;/li&gt;
&lt;li&gt;curiosity becomes more focused&lt;/li&gt;
&lt;li&gt;&lt;p&gt;motivation becomes easier to sustain&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;beginner curiosity = broad and chaotic&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;expert curiosity = narrow and deep&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  8. Identity (the stabiliser layer)
&lt;/h2&gt;

&lt;p&gt;Identity is the story you tell yourself about who you are.&lt;/p&gt;

&lt;p&gt;People are more consistent with identity than with goals.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“I am an engineer”&lt;/li&gt;
&lt;li&gt;“I build systems”&lt;/li&gt;
&lt;li&gt;“I understand how things work”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Identity affects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what you become curious about&lt;/li&gt;
&lt;li&gt;what you persist in&lt;/li&gt;
&lt;li&gt;what you ignore entirely&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  9. Flow (where the system aligns)
&lt;/h2&gt;

&lt;p&gt;Flow is a state where attention, curiosity, and skill align, making action feel effortless.&lt;/p&gt;

&lt;p&gt;Flow happens when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;curiosity is active&lt;/li&gt;
&lt;li&gt;motivation is frictionless&lt;/li&gt;
&lt;li&gt;challenge matches skill&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In flow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;attention locks in completely&lt;/li&gt;
&lt;li&gt;time perception fades&lt;/li&gt;
&lt;li&gt;effort feels reduced&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Flow is the temporary equilibrium of the system.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Learning (the output of the system)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Curiosity selects what we explore&lt;/li&gt;
&lt;li&gt;Motivation sustains engagement&lt;/li&gt;
&lt;li&gt;Feedback refines understanding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learning is structured change in understanding over time.&lt;/p&gt;

&lt;p&gt;Without curiosity → no direction&lt;br&gt;&lt;br&gt;
Without motivation → no persistence&lt;br&gt;&lt;br&gt;
Without feedback → no improvement&lt;/p&gt;




&lt;h2&gt;
  
  
  Putting it all together
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Attention → what enters awareness&lt;/li&gt;
&lt;li&gt;Curiosity → what gets explored&lt;/li&gt;
&lt;li&gt;Interest → what repeats&lt;/li&gt;
&lt;li&gt;Motivation → what continues&lt;/li&gt;
&lt;li&gt;Friction → what blocks action&lt;/li&gt;
&lt;li&gt;Reward → what reinforces behaviour&lt;/li&gt;
&lt;li&gt;Agency → belief that action matters&lt;/li&gt;
&lt;li&gt;Competence → ability to reduce uncertainty&lt;/li&gt;
&lt;li&gt;Identity → long-term consistency&lt;/li&gt;
&lt;li&gt;Flow → aligned execution state&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final reflection
&lt;/h2&gt;

&lt;p&gt;Looking back, the professor’s advice makes more sense now.&lt;/p&gt;

&lt;p&gt;Curiosity is not just a feeling — it is a navigation system.&lt;/p&gt;

&lt;p&gt;It directs attention toward uncertainty, builds interest through repeated exploration, develops competence through learning, and gradually shapes identity.&lt;/p&gt;

&lt;p&gt;We often assume successful people knew exactly where they were going. In reality, many simply followed questions they could not stop asking.&lt;/p&gt;

&lt;p&gt;Certainty feels safe.&lt;/p&gt;

&lt;p&gt;Curiosity is valuable because it reveals paths that cannot be planned in advance.&lt;/p&gt;

&lt;p&gt;The future is too complex to predict.&lt;/p&gt;

&lt;p&gt;But it is often possible to notice what genuinely pulls your attention — and take one step further in that direction.&lt;/p&gt;

&lt;p&gt;That is usually enough.&lt;/p&gt;

&lt;p&gt;You don’t need a perfect plan.&lt;/p&gt;

&lt;p&gt;You need a direction that keeps generating curiosity as you move.&lt;/p&gt;

</description>
      <category>career</category>
      <category>learning</category>
      <category>productivity</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>From Skills to Systems — How We Package and Control AI Capabilities</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 17 May 2026 20:33:32 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/from-skills-to-systems-how-we-package-and-control-ai-capabilities-4l1p</link>
      <guid>https://dev.to/vladimirivanov/from-skills-to-systems-how-we-package-and-control-ai-capabilities-4l1p</guid>
      <description>&lt;p&gt;As AI systems move from single models to composable agent and skills ecosystems, the bottleneck is no longer intelligence.&lt;/p&gt;

&lt;p&gt;It is control.&lt;/p&gt;

&lt;p&gt;Not just what an AI can do — but how capabilities are packaged, deployed, isolated, updated, and safely combined across teams and environments.&lt;/p&gt;

&lt;p&gt;This is where “skills” stop being conceptual features and start behaving like software artifacts.&lt;/p&gt;

&lt;p&gt;And once that happens, we need to treat them like systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Skills Are Becoming Deployable Units
&lt;/h2&gt;

&lt;p&gt;A “skill” is no longer just a prompt or function.&lt;/p&gt;

&lt;p&gt;It is a packaged capability with behaviour, dependencies, and runtime assumptions.&lt;/p&gt;

&lt;p&gt;This changes everything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It must be versioned&lt;/li&gt;
&lt;li&gt;It must be testable&lt;/li&gt;
&lt;li&gt;It must be composable&lt;/li&gt;
&lt;li&gt;It must fail safely&lt;/li&gt;
&lt;li&gt;It must evolve independently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At that point, a skill is closer to a microservice than a prompt.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Distributed Skills: Three-Tier Model
&lt;/h2&gt;

&lt;p&gt;Instead of colocation vs separation, skills are better understood by where they belong in the reuse hierarchy — their scope, ownership, and governance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tier 1 — Codebase-Local Skills
&lt;/h3&gt;

&lt;p&gt;Skills inside a single project or library.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Highly contextual and tightly coupled&lt;/li&gt;
&lt;li&gt;Not reusable&lt;/li&gt;
&lt;li&gt;Fast to iterate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Optimised for speed, not portability.&lt;/p&gt;




&lt;h3&gt;
  
  
  Tier 2 — Company-Shared Skills (Private Registry)
&lt;/h3&gt;

&lt;p&gt;Shared across teams within an organisation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reusable internally&lt;/li&gt;
&lt;li&gt;Versioned and governed&lt;/li&gt;
&lt;li&gt;Encodes company-specific logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Optimised for consistency at scale.&lt;/p&gt;




&lt;h3&gt;
  
  
  Tier 3 — Public Marketplace Skills
&lt;/h3&gt;

&lt;p&gt;Reusable across organisations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Standardised and general-purpose&lt;/li&gt;
&lt;li&gt;Discoverable via registries&lt;/li&gt;
&lt;li&gt;Ecosystem or vendor maintained&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Optimised for interoperability and reach.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Skill Packaging Model
&lt;/h2&gt;

&lt;p&gt;A skill is a structured capability, not inline logic.&lt;/p&gt;

&lt;p&gt;Typical components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Interface (inputs/outputs)&lt;/li&gt;
&lt;li&gt;Behaviour definition&lt;/li&gt;
&lt;li&gt;Dependencies&lt;/li&gt;
&lt;li&gt;Policies&lt;/li&gt;
&lt;li&gt;Metadata (version, ownership)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This turns skills into deployable units.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Registries and Distribution Systems
&lt;/h2&gt;

&lt;p&gt;Skills require a registry (marketplace) for discovery and governance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Versioned storage&lt;/li&gt;
&lt;li&gt;Ownership tracking&lt;/li&gt;
&lt;li&gt;Controlled publishing&lt;/li&gt;
&lt;li&gt;Cross-system discovery&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Skills become managed assets, not scattered logic.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Versioning Strategies
&lt;/h2&gt;

&lt;p&gt;Behaviour matters as much as structure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Major → breaking behaviour change&lt;/li&gt;
&lt;li&gt;Minor → added capability&lt;/li&gt;
&lt;li&gt;Patch → internal fixes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Behavioural contracts are needed to maintain predictability across versions.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Dependency Management for Skills
&lt;/h2&gt;

&lt;p&gt;Skills depend on tools, models, and other skills.&lt;/p&gt;

&lt;p&gt;This creates dependency graphs requiring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version pinning&lt;/li&gt;
&lt;li&gt;Compatibility rules&lt;/li&gt;
&lt;li&gt;Conflict resolution&lt;/li&gt;
&lt;li&gt;Transitive dependency visibility&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without this, small changes cascade into system-wide effects.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Testing: From Unit to Behavioural Evaluation
&lt;/h2&gt;

&lt;p&gt;Testing must extend beyond unit tests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unit → deterministic behaviour&lt;/li&gt;
&lt;li&gt;Integration → composition with tools/skills&lt;/li&gt;
&lt;li&gt;Behavioural → ambiguous real-world cases&lt;/li&gt;
&lt;li&gt;System-level → full agent simulations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most failures appear only in composition.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Agent Package Managers
&lt;/h2&gt;

&lt;p&gt;Agents become execution environments for skills.&lt;/p&gt;

&lt;p&gt;They handle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installation and updates&lt;/li&gt;
&lt;li&gt;Dependency resolution&lt;/li&gt;
&lt;li&gt;Version locking&lt;/li&gt;
&lt;li&gt;Runtime configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Similar to package managers, but for behaviour systems.&lt;br&gt;
For example, emerging platforms like Vercel’s AI/agent workflows and Microsoft’s agent frameworks point toward this direction — where capabilities are installed, composed, and managed rather than hardcoded into a single system.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. MCP as a Distribution Interface
&lt;/h2&gt;

&lt;p&gt;Model Context Protocol (MCP) acts as a standard interface for exposing skills and tools.&lt;/p&gt;

&lt;p&gt;It enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Standardised capability access&lt;/li&gt;
&lt;li&gt;Plug-and-play integration&lt;/li&gt;
&lt;li&gt;Separation of logic and providers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A shift from hardcoded integrations to interoperable systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Multi-Team and Third-Party Skill Ecosystems
&lt;/h2&gt;

&lt;p&gt;Skills evolve into ecosystems across organisations.&lt;/p&gt;

&lt;p&gt;Key challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Governance and ownership&lt;/li&gt;
&lt;li&gt;Trust and safety&lt;/li&gt;
&lt;li&gt;Compatibility management&lt;/li&gt;
&lt;li&gt;Marketplace dynamics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI systems begin to behave like platforms.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing Insight
&lt;/h2&gt;

&lt;p&gt;AI systems are shifting from model-centric design to capability-centric systems engineering.&lt;/p&gt;

&lt;p&gt;Skills are no longer prompts or utilities — they are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Versioned&lt;/li&gt;
&lt;li&gt;Distributed&lt;/li&gt;
&lt;li&gt;Governed&lt;/li&gt;
&lt;li&gt;Composed&lt;/li&gt;
&lt;li&gt;Tested at system level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The real challenge is no longer building intelligence, but building safe capability systems at scale.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>softwareengineering</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>We’re Repeating Dependency Hell — But Now It’s AI Behaviour, Not Code</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 17 May 2026 20:01:46 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/were-repeating-dependency-hell-but-now-its-ai-behaviour-agents-and-skills-not-code-1d5m</link>
      <guid>https://dev.to/vladimirivanov/were-repeating-dependency-hell-but-now-its-ai-behaviour-agents-and-skills-not-code-1d5m</guid>
      <description>&lt;p&gt;Software engineering already learned a painful lesson once: when dependencies are unmanaged, systems slowly collapse under their own complexity.&lt;br&gt;
Version mismatches, hidden upgrades, and transitive chaos led to what we now call dependency hell.&lt;br&gt;
We solved it with package managers, lock files, and disciplined release cycles.&lt;br&gt;
But in the era of AI systems and agentic software, we are quietly rebuilding the same problem — just at a higher layer.&lt;/p&gt;

&lt;p&gt;This time, it’s not code that is changing underneath us.&lt;br&gt;
It’s behaviour. Tools, skills, prompts, and models are evolving in ways that subtly alter how systems think, decide, and act — often without anyone explicitly noticing.&lt;/p&gt;




&lt;h2&gt;
  
  
  AI Behaviour is a Composed System
&lt;/h2&gt;

&lt;p&gt;AI behaviour is not produced by skills alone. It emerges from the interaction between the underlying model, prompts, and the agent layer that orchestrates actions over time.&lt;br&gt;
Prompts shape interpretation of intent, agents define multi-step reasoning and tool use, and skills provide the external capabilities that can be invoked.&lt;/p&gt;

&lt;p&gt;Together, these form a single system where behaviour is not just generated, but executed through a combination of reasoning and action.&lt;/p&gt;




&lt;h2&gt;
  
  
  What "Skills" Actually Are
&lt;/h2&gt;

&lt;p&gt;To understand why this matters, we need to be precise about what "skills" actually are in modern AI systems.&lt;br&gt;
At their core, they are not magical extensions — they are structured function calls with defined inputs, outputs, and side effects.&lt;/p&gt;

&lt;p&gt;A skill might wrap an API request, database query, or external service, but fundamentally it is a callable capability exposed to an agent.&lt;/p&gt;

&lt;p&gt;The key difference from traditional software is not their structure, but how they are used.&lt;br&gt;
In conventional systems, functions are invoked explicitly and deterministically by developers.&lt;br&gt;
In agent-based systems, the same functions are selected, invoked, and composed dynamically by a model based on interpreted intent.&lt;/p&gt;

&lt;p&gt;This shifts skills from passive utilities into active participants in decision-making.&lt;/p&gt;

&lt;p&gt;As a result, skills are not informal integrations — they are production-grade interfaces that require strict contracts, versioning, backward compatibility, and testing.&lt;br&gt;
A change in a skill’s schema or behaviour is equivalent to changing a function signature in a distributed system — except failures are often silent and semantic rather than immediate.&lt;/p&gt;




&lt;h2&gt;
  
  
  Integration and Systemic Risk
&lt;/h2&gt;

&lt;p&gt;Skills rarely operate in isolation. Agents compose multiple tools within a single workflow, making integration boundaries critical.&lt;br&gt;
A change in one skill can cascade through the system and alter downstream behaviour in unexpected ways.&lt;/p&gt;

&lt;p&gt;This is why integration testing across versioned skills is essential — not just validating each skill independently, but validating composed systems such as:&lt;/p&gt;

&lt;p&gt;skill A v1.2 + skill B v2.0 + model X&lt;/p&gt;

&lt;p&gt;ensuring they still produce stable outcomes.&lt;/p&gt;

&lt;p&gt;Without this, the risk is not just broken functions — it is broken reasoning chains.&lt;/p&gt;




&lt;h2&gt;
  
  
  MCP and the Skill Layer
&lt;/h2&gt;

&lt;p&gt;We are already seeing this shift in systems like MCP (Model Context Protocol), where tools and data sources are exposed to models through standardised interfaces.&lt;/p&gt;

&lt;p&gt;MCP effectively formalises skills as discoverable, callable services — closer to APIs in distributed systems than prompts or informal plugins.&lt;/p&gt;

&lt;p&gt;This reinforces a key architectural reality: once capabilities are exposed to an agent, they become part of a dynamic execution graph and must be treated as versioned, testable, and composable units.&lt;/p&gt;




&lt;h2&gt;
  
  
  Installable, Reusable, Distributed Skills
&lt;/h2&gt;

&lt;p&gt;Skills naturally evolve into installable, reusable, and composable components.&lt;br&gt;
Once exposed externally, they can be distributed, installed from registries, and reused across multiple agent systems like packages in traditional software ecosystems.&lt;/p&gt;

&lt;p&gt;Unlike traditional libraries, skills are often triggered through plain English intent, where an agent interprets a request and selects the appropriate capability.&lt;/p&gt;

&lt;p&gt;But the outputs are not free-form. They are structured results designed for further composition — where one skill feeds another, enabling dynamic multi-step workflows.&lt;/p&gt;

&lt;p&gt;This turns skills into building blocks for runtime composition. Systems are no longer pre-wired pipelines, but graphs of reusable capabilities assembled at execution time.&lt;/p&gt;

&lt;p&gt;This composability increases power — but also risk. Small changes can propagate across reasoning chains in ways that are difficult to predict without strict versioning and integration testing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Just Chat vs Systems That Actually Execute
&lt;/h2&gt;

&lt;p&gt;In a basic chat system, the model is stateless and general-purpose. It responds using internal knowledge, with no reliable external execution layer or guarantees about how actions are performed.&lt;/p&gt;

&lt;p&gt;In contrast, a skill-enabled system orchestrates versioned capabilities. A user request in natural language can trigger specific tools with strict contracts, predictable side effects, and composable outputs.&lt;/p&gt;

&lt;p&gt;The system becomes a hybrid:&lt;br&gt;
natural language for intent → structured execution via skills.&lt;/p&gt;

&lt;p&gt;This is why skills are not just enhancements — they fundamentally change what the system is capable of doing reliably.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cost and Scale Implications
&lt;/h2&gt;

&lt;p&gt;At first glance, skills, versioning, and composable tool systems look like overhead. They introduce real complexity: interface design, backward compatibility, integration testing, and registry management.&lt;/p&gt;

&lt;p&gt;But in production systems, the real cost is not infrastructure — it is unpredictability at scale.&lt;/p&gt;

&lt;p&gt;Unmanaged tool usage leads to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;inefficient routing&lt;/li&gt;
&lt;li&gt;repeated model calls&lt;/li&gt;
&lt;li&gt;silent failures&lt;/li&gt;
&lt;li&gt;expensive debugging cycles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As systems grow, cost increases not linearly, but through accumulated uncertainty.&lt;/p&gt;

&lt;p&gt;Well-designed skill systems change this dynamic. They move deterministic work out of the model, reduce redundant reasoning, and enable cheaper execution paths. More importantly, they reduce the hidden operational cost of ambiguity.&lt;/p&gt;

&lt;p&gt;Skills and versioning are not just a cost optimisation — they are a mechanism for controlling complexity growth.&lt;/p&gt;

&lt;p&gt;Without them, cost does not scale with usage. It scales with entropy.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing Insight
&lt;/h2&gt;

&lt;p&gt;The shift is not simply that we are adding tools to AI systems.&lt;br&gt;
It is that we are turning capabilities into software artifacts that directly shape reasoning.&lt;/p&gt;

&lt;p&gt;Once that happens, every change becomes meaningful.&lt;br&gt;
A version bump is no longer just a code update — it is a potential change in behaviour, decisions, and system-wide outcomes.&lt;/p&gt;

&lt;p&gt;This is why the next evolution of software engineering is not just about writing better functions.&lt;/p&gt;

&lt;p&gt;It is about controlling the behavioural surface area of systems that think in language but execute in code.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Mental Algorithms: How AI Changes the Cost of Thinking</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 17 May 2026 09:16:24 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/mental-algorithms-how-ai-changes-the-cost-of-thinking-48ho</link>
      <guid>https://dev.to/vladimirivanov/mental-algorithms-how-ai-changes-the-cost-of-thinking-48ho</guid>
      <description>&lt;p&gt;Most people assume the difference between good thinking and bad thinking is intelligence.&lt;/p&gt;

&lt;p&gt;It isn't.&lt;/p&gt;

&lt;p&gt;More often, it comes down to cost — how much mental effort it takes to arrive at a useful answer. Some answers require slow, deliberate reasoning. Others emerge almost instantly through pattern recognition or experience.&lt;/p&gt;

&lt;p&gt;Human thinking isn't a single process. It's a collection of reusable patterns — some fast, some careful, some surprisingly fragile depending on context.&lt;/p&gt;

&lt;p&gt;AI doesn't replace these patterns. It changes what they cost to use.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Structured Thinking (Slow, Deliberate Reasoning)
&lt;/h2&gt;

&lt;p&gt;This is the kind of thinking people usually mean when they talk about "deep work" or "careful reasoning". It prioritises correctness over speed, and it tends to feel effortful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decomposition
&lt;/h3&gt;

&lt;p&gt;Large problems rarely stay large once you start breaking them apart. Splitting something into smaller components makes it easier to understand, reason about, and eventually solve. In software, this is the difference between an overwhelming system and a set of manageable modules.&lt;/p&gt;

&lt;p&gt;AI is especially good at this first pass. It can outline a system or break down a problem in seconds — something that would normally take a whiteboard session and some back-and-forth.&lt;/p&gt;

&lt;h3&gt;
  
  
  Abstraction
&lt;/h3&gt;

&lt;p&gt;Abstraction is the act of ignoring detail on purpose. You don’t need to understand everything to use something effectively — just the parts that matter.&lt;/p&gt;

&lt;p&gt;Good engineers instinctively group things that change together and separate things that don't. That decision — what to include and what to ignore — is still very human. AI can assist with structure, but judgment still sits on your side.&lt;/p&gt;

&lt;h3&gt;
  
  
  Iteration
&lt;/h3&gt;

&lt;p&gt;Most real progress doesn’t happen in one leap. It happens through repeated cycles: try something, observe what breaks, adjust, repeat.&lt;/p&gt;

&lt;p&gt;What AI changes here is speed. Iteration cycles that once took hours or days can now happen in minutes. The loop stays the same — it just becomes much cheaper to run.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hypothesis Testing
&lt;/h3&gt;

&lt;p&gt;Good debugging isn’t guessing randomly. It’s forming small, testable ideas and checking them one at a time.&lt;/p&gt;

&lt;p&gt;AI helps by suggesting likely causes or next steps, but the grounding still comes from reality — logs, outputs, behaviour. It can accelerate thinking, but it can't replace validation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Systems Thinking
&lt;/h3&gt;

&lt;p&gt;At some point, you stop looking at parts and start looking at interactions. Changing one thing affects others in ways that aren’t always obvious — performance, reliability, consistency.&lt;/p&gt;

&lt;p&gt;AI can map dependencies reasonably well, but real systems tend to reveal their complexity only when they're running under pressure. That's where intuition still matters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Edge Cases
&lt;/h3&gt;

&lt;p&gt;Most real bugs don't come from the "normal path". They appear at the edges — empty inputs, failed requests, race conditions, unexpected states.&lt;/p&gt;

&lt;p&gt;AI can suggest some of these, but domain-specific edge cases usually come from experience rather than inference.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Fast Thinking (Heuristics and Shortcuts)
&lt;/h2&gt;

&lt;p&gt;Fast thinking is what gets used most of the time in real life. It's not careful — it's efficient. It trades precision for speed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Heuristics
&lt;/h3&gt;

&lt;p&gt;Rules of thumb like "start simple", "avoid premature optimisation", or "readability over cleverness" exist because they work often enough to be useful.&lt;/p&gt;

&lt;p&gt;AI tends to generate a default version of these heuristics, which is helpful — but also risky if you accept them without thinking. The baseline gets easier, but that also makes it easier to stop questioning it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Satisficing
&lt;/h3&gt;

&lt;p&gt;Most decisions aren't about finding the best option. They're about finding one that's good enough to move forward.&lt;/p&gt;

&lt;p&gt;AI lowers the threshold for "good enough" dramatically. That changes behaviour: people stop searching earlier because acceptable solutions appear faster.&lt;/p&gt;

&lt;h3&gt;
  
  
  Anchoring
&lt;/h3&gt;

&lt;p&gt;The first answer you see tends to shape everything that follows.&lt;/p&gt;

&lt;p&gt;With AI, that anchor is often the first generated response — fluent, confident, and structured. That makes it especially sticky, even when it's not optimal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Availability Bias
&lt;/h3&gt;

&lt;p&gt;We tend to estimate likelihood based on what comes to mind easily.&lt;/p&gt;

&lt;p&gt;AI shifts what becomes "easy to recall" toward patterns it has seen most often in its training data. That subtly biases thinking toward common solutions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Narrative Thinking
&lt;/h3&gt;

&lt;p&gt;Humans like stories. We compress complexity into something linear and understandable.&lt;/p&gt;

&lt;p&gt;AI is extremely good at producing narratives, even when reality is messy. That makes explanations clearer — but also sometimes cleaner than reality actually is.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Simulation and Future Thinking
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Mental Simulation
&lt;/h3&gt;

&lt;p&gt;We constantly run mental "what if" scenarios before acting.&lt;/p&gt;

&lt;p&gt;AI expands this space dramatically. Instead of imagining two or three outcomes, you can explore dozens in seconds.&lt;/p&gt;

&lt;h3&gt;
  
  
  Regret Minimisation
&lt;/h3&gt;

&lt;p&gt;Many decisions are really about avoiding future regret.&lt;/p&gt;

&lt;p&gt;When alternatives are easy to generate, comparing outcomes becomes more explicit — and sometimes more overwhelming.&lt;/p&gt;

&lt;h3&gt;
  
  
  Opportunity Cost
&lt;/h3&gt;

&lt;p&gt;Every decision excludes others, but we don't usually feel that cost clearly.&lt;/p&gt;

&lt;p&gt;AI makes execution cheaper, which ironically makes decision-making more important. When doing is easy, choosing becomes the real bottleneck.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. The Meta Layer — Thinking About Thinking
&lt;/h2&gt;

&lt;p&gt;The hardest shift isn’t technical. It’s awareness.&lt;/p&gt;

&lt;p&gt;It’s knowing when you’re reasoning carefully versus when you’re just following a fluent suggestion that feels like reasoning.&lt;/p&gt;

&lt;p&gt;AI blurs that boundary. You can easily feel like you’ve thought something through when you’ve actually just selected from a well-phrased option.&lt;/p&gt;

&lt;p&gt;That makes feedback loops more important than ever — checking, testing, and re-evaluating what you assume is true.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing Thought
&lt;/h2&gt;

&lt;p&gt;Thinking isn’t a single skill. It’s a set of patterns we switch between constantly, usually without noticing.&lt;/p&gt;

&lt;p&gt;Most errors don’t come from lack of intelligence. They come from using the wrong pattern for the situation.&lt;/p&gt;

&lt;p&gt;AI doesn’t change that.&lt;/p&gt;

&lt;p&gt;It just makes every pattern cheaper — and the switching between them less visible.&lt;/p&gt;

&lt;p&gt;Which means the real skill is no longer just thinking well.&lt;/p&gt;

&lt;p&gt;It’s noticing what kind of thinking you’re doing while it’s happening.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>learning</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>The Silent Knowledge Tax Inside Engineering Teams — And Why It Matters More in the Age of AI</title>
      <dc:creator>vladimir ivanov</dc:creator>
      <pubDate>Sun, 10 May 2026 13:45:50 +0000</pubDate>
      <link>https://dev.to/vladimirivanov/the-silent-knowledge-tax-inside-engineering-teams-and-why-it-matters-more-in-the-age-of-ai-5g1g</link>
      <guid>https://dev.to/vladimirivanov/the-silent-knowledge-tax-inside-engineering-teams-and-why-it-matters-more-in-the-age-of-ai-5g1g</guid>
      <description>&lt;p&gt;&lt;em&gt;A look at why engineering knowledge stays locked in individuals—and how AI changes the economics of sharing it.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Most engineering teams don’t struggle because people don’t know enough.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;They struggle because most of what people know never leaves their head.&lt;/p&gt;

&lt;p&gt;In most organisations, only a small number of people consistently document what they know, share reusable solutions, and help others avoid repeating the same work. Most do not—not because they lack capability, but because knowledge rarely becomes something that is naturally captured, shared, and reused.&lt;/p&gt;




&lt;h2&gt;
  
  
  The silent knowledge tax
&lt;/h2&gt;

&lt;p&gt;There is a hidden cost inside most engineering teams that rarely gets talked about.&lt;/p&gt;

&lt;p&gt;It is not technical debt.&lt;/p&gt;

&lt;p&gt;It is a knowledge tax.&lt;/p&gt;

&lt;p&gt;When skills remain trapped inside individuals, organisations repeatedly pay for the same problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;duplicated work
&lt;/li&gt;
&lt;li&gt;repeated mistakes
&lt;/li&gt;
&lt;li&gt;slower onboarding
&lt;/li&gt;
&lt;li&gt;inconsistent implementations
&lt;/li&gt;
&lt;li&gt;dependency on a few key people
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every time a problem is solved again instead of being reused, the organisation pays that tax again.&lt;/p&gt;




&lt;h2&gt;
  
  
  The real reason people don’t share knowledge
&lt;/h2&gt;

&lt;p&gt;Most people do not share what they know—not because they are unwilling, but because the immediate personal reward strongly favours building and solving over explaining and documenting.&lt;/p&gt;

&lt;p&gt;Writing code, fixing problems, and shipping features provide clear and immediate feedback. Sharing knowledge, by contrast, requires additional cognitive effort and offers delayed, uncertain, and often invisible rewards. As a result, even highly capable engineers naturally prioritise execution over articulation.&lt;/p&gt;




&lt;h2&gt;
  
  
  The value of the few who do share
&lt;/h2&gt;

&lt;p&gt;In every engineering organisation, there are a few people who consistently document what they know, share reusable solutions, and help others avoid repeating the same work.&lt;/p&gt;

&lt;p&gt;In doing so, they also help themselves:&lt;br&gt;
they create a record they can return to later, reducing the need to rediscover forgotten knowledge and avoiding the need to reinvent the wheel.&lt;/p&gt;

&lt;p&gt;By writing ideas down, they make their thinking explicit and easier to communicate. Once shared, those ideas become open to review, discussion, and refinement—often improving through feedback from colleagues.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why knowledge stays trapped inside individuals
&lt;/h2&gt;

&lt;p&gt;The problem is not unwillingness or lack of skill. It is a combination of cognitive load, incentives, identity, and visibility.&lt;/p&gt;

&lt;p&gt;Sharing knowledge requires switching from “doing” to “explaining,” and most systems are optimised for doing.&lt;/p&gt;

&lt;p&gt;Hiring talented people is necessary, but it is not sufficient. Most engineers already have strong ideas, valuable experience, and deep understanding of how problems should be solved. The issue is not capability—it is that very little of that knowledge becomes a shared organisational asset.&lt;/p&gt;

&lt;p&gt;This extends far beyond documentation. It includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reusable code libraries
&lt;/li&gt;
&lt;li&gt;architectural patterns
&lt;/li&gt;
&lt;li&gt;coding standards
&lt;/li&gt;
&lt;li&gt;prompts and AI workflows
&lt;/li&gt;
&lt;li&gt;automation scripts
&lt;/li&gt;
&lt;li&gt;lessons learned from past projects
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When these assets are created and shared, they reduce duplication, improve consistency, and allow teams to build on each other’s work instead of starting from scratch.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why people don’t actively share knowledge
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Cognitive effort and explanation cost
&lt;/h3&gt;

&lt;p&gt;Explaining ideas requires structured thinking, extra effort, and interruption of workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Loss of perceived uniqueness
&lt;/h3&gt;

&lt;p&gt;Some fear that sharing reduces their “edge” or makes their expertise less distinctive within the team.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Ownership ambiguity
&lt;/h3&gt;

&lt;p&gt;When knowledge is not clearly owned:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no one is responsible for documenting it
&lt;/li&gt;
&lt;li&gt;effort feels optional
&lt;/li&gt;
&lt;li&gt;it becomes invisible work
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This leads to diffusion of responsibility—everyone assumes someone else will do it.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Low emotional reward (dopamine mismatch)
&lt;/h3&gt;

&lt;p&gt;Coding provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;immediate progress signals
&lt;/li&gt;
&lt;li&gt;problem-solving satisfaction
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sharing provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;delayed, indirect benefits
&lt;/li&gt;
&lt;li&gt;no immediate “win”
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the brain prioritises execution over documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Fear of criticism or being wrong
&lt;/h3&gt;

&lt;p&gt;Shared ideas are exposed to review, discussion, and correction, which can discourage people from publishing imperfect knowledge.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Lack of recognition or reward
&lt;/h3&gt;

&lt;p&gt;Knowledge sharing is rarely measured or rewarded, so it is deprioritised compared to visible delivery work.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Time pressure and workload
&lt;/h3&gt;

&lt;p&gt;Under delivery pressure, documentation and knowledge sharing are often postponed indefinitely.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. “I’ll document it later” effect
&lt;/h3&gt;

&lt;p&gt;People assume they will write things down later, but context fades, details are lost, and motivation disappears.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Social invisibility of sharing work
&lt;/h3&gt;

&lt;p&gt;In most teams:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;writing code is visible
&lt;/li&gt;
&lt;li&gt;shipping features is visible
&lt;/li&gt;
&lt;li&gt;sharing knowledge is invisible
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a result, even strong contributors naturally optimise for visible impact.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why this matters more in the age of AI
&lt;/h2&gt;

&lt;p&gt;As AI becomes embedded in engineering workflows, “knowledge” increasingly includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prompts
&lt;/li&gt;
&lt;li&gt;workflows
&lt;/li&gt;
&lt;li&gt;automation patterns
&lt;/li&gt;
&lt;li&gt;tool usage strategies
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If this knowledge remains trapped inside individuals, organisations fail to turn AI into a scalable capability.&lt;/p&gt;

&lt;p&gt;The real advantage in the AI era is no longer just having smart people, but creating systems where their skills—human and AI-assisted—become shared, reusable, and continuously improved.&lt;/p&gt;




&lt;h2&gt;
  
  
  From individual knowledge to reusable AI skills
&lt;/h2&gt;

&lt;p&gt;The shift happening with AI is not just that engineers can do more.&lt;/p&gt;

&lt;p&gt;It is that skills themselves can now be designed to be reusable.&lt;/p&gt;

&lt;p&gt;Traditionally, engineering knowledge has been:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;implicit
&lt;/li&gt;
&lt;li&gt;personal
&lt;/li&gt;
&lt;li&gt;context-dependent
&lt;/li&gt;
&lt;li&gt;hard to transfer
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even when documented, it often loses meaning outside the original situation.&lt;/p&gt;

&lt;p&gt;But when knowledge is expressed as prompts, workflows, reusable instructions, and structured patterns, it becomes something closer to a portable capability, not just personal understanding.&lt;/p&gt;




&lt;h2&gt;
  
  
  What changes when skills become reusable
&lt;/h2&gt;

&lt;p&gt;When skills are not reusable, teams scale slowly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;one person learns something
&lt;/li&gt;
&lt;li&gt;others gradually copy it
&lt;/li&gt;
&lt;li&gt;knowledge spreads unevenly
&lt;/li&gt;
&lt;li&gt;mistakes are repeated
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But when skills are designed to be shared:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;one improvement benefits everyone instantly
&lt;/li&gt;
&lt;li&gt;workflows become consistent
&lt;/li&gt;
&lt;li&gt;best practices propagate automatically
&lt;/li&gt;
&lt;li&gt;learning compounds across the organisation
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of knowledge diffusing through people, it becomes embedded in systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  The real contrast
&lt;/h2&gt;

&lt;p&gt;Traditional engineering teams:&lt;/p&gt;

&lt;p&gt;knowledge lives in people → slow transfer → repeated work  &lt;/p&gt;

&lt;p&gt;AI-enabled teams:&lt;/p&gt;

&lt;p&gt;knowledge lives in shared skills and agents → instant reuse → compounding improvement  &lt;/p&gt;

&lt;p&gt;This is the real shift.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing insight
&lt;/h2&gt;

&lt;p&gt;The most valuable engineering teams are not the ones with the best individual engineers.&lt;/p&gt;

&lt;p&gt;They are the ones that turn individual knowledge into shared intelligence.&lt;/p&gt;

&lt;p&gt;And in the age of AI, the advantage no longer comes from what people know individually.&lt;/p&gt;

&lt;p&gt;It comes from what they are able to share, reuse, and scale together.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>management</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
