Takina · · 5 min read JavaScript Custom Errors and Error Cause, Explained
JavaScript custom error classes and the Error cause option let you throw specific, chainable errors. How to define them, wrap failures, and handle them well.
Topic
36 posts tagged “TypeScript”.
Takina · · 5 min read JavaScript custom error classes and the Error cause option let you throw specific, chainable errors. How to define them, wrap failures, and handle them well.
Takina · · 4 min read Structural typing checks shape, not name — TypeScript treats two differently-named types as compatible if their members match, unlike nominal systems.
Takina · · 4 min read Biome is a Rust-based linter and formatter that replaces ESLint and Prettier with one faster tool, one config file, and no plugin ecosystem to manage.
Takina · · 5 min read Variance decides when TypeScript accepts Array<Dog> where Array<Animal> is expected — covariant, contravariant, or invariant, explained with examples.
Takina · · 5 min read Zod infers static TypeScript types directly from its schemas; Yup was built for JavaScript form validation first. How the two approaches differ.
Takina · · 5 min read A .d.ts file describes a library's types without its implementation. How TypeScript declaration files work, and how to write one for an untyped JS package.
Takina · · 4 min read A TypeScript tuple is a fixed-length array where each position has its own type. How tuples work, labeled elements, and when to use them over arrays.
Takina · · 4 min read Astro content collections give markdown and MDX files a type-safe schema and a query API, catching bad frontmatter at build time instead of runtime.
Takina · · 4 min read An index signature lets a TypeScript type describe objects whose keys aren't known in advance. How the syntax works, and when to reach for a Record instead.
The Lycoris Team · · 4 min read TypeScript's moduleResolution setting decides how import paths map to files. How node10, node16, and bundler resolution differ, and which to pick.
Takina · · 4 min read TypeScript is JavaScript plus a compile-time type system — same runtime, different guarantees. Where each one wins and how they fit together.
Takina · · 4 min read tRPC lets TypeScript clients call server functions with full type inference and no schema or codegen step. How it works and where it fits.
Takina · · 5 min read Branded types attach a compile-time-only tag to a primitive so TypeScript rejects mixing values that share a shape but not a meaning.
Chisato · · 4 min read Prisma generates a type-safe client from a schema file and runs through its own query engine; Drizzle is a thinner, SQL-like query builder with no engine.
Takina · · 4 min read Declaration merging lets TypeScript combine multiple declarations of the same name into one — the mechanism behind extending interfaces and global types.
Takina · · 4 min read Abstract classes in TypeScript define shared implementation plus methods subclasses must fill in. How they differ from interfaces and when to reach for them.
Takina · · 3 min read never represents values that can't exist — it marks unreachable code, exhaustive switches, and functions that always throw or loop forever.
Takina · · 4 min read TypeScript's readonly keyword blocks reassignment at compile time for properties, arrays, and tuples — with no runtime enforcement at all.
Takina · · 4 min read TypeScript's as const assertion locks a value to its literal, readonly type instead of widening it. How it works and when to reach for it.
Takina · · 5 min read Type guards are functions and checks that narrow a TypeScript union to a specific type at runtime. How typeof, instanceof, in, and custom guards work.
Takina · · 4 min read TypeScript function overloads let one function name accept multiple call signatures with different types. How overload signatures work and when to use them.
Takina · · 4 min read Tagged template literals let a function intercept a template string's parts before interpolation — the mechanism behind safe SQL, styled-components, and i18n.
Takina · · 4 min read tsconfig.json controls how TypeScript checks and compiles your code. Here are the options that actually change behavior, and the ones you can leave alone.
Takina · · 4 min read Template literal types let TypeScript build string types from other types, like JavaScript template strings. How they work, with practical patterns.
Takina · · 4 min read TypeScript's interface and type both describe object shapes, but they diverge on declaration merging, unions, and extension. When to reach for each.
Takina · · 4 min read Mapped types transform one type into another by iterating over its keys — the mechanism behind Partial, Readonly, Record, and Pick under the hood.
Takina · · 4 min read TypeScript enums group named constants under one type. How numeric, string, and const enums compile, and when a union type is the better choice.
Takina · · 4 min read A discriminated union tags each variant of a type with a shared literal field, letting TypeScript narrow the type automatically inside a switch or if check.
Takina · · 4 min read TypeScript's unknown forces a type check before use; any opts out of type checking entirely. When to reach for each in real code.
Takina · · 4 min read Conditional types let TypeScript pick a type based on another type, using T extends U ? X : Y — the foundation of most advanced type utilities.
Takina · · 4 min read TypeScript's satisfies operator checks a value against a type without widening or erasing its inferred literal type. Here's when to reach for it.
Takina · · 4 min read TypeScript decorators attach reusable behavior to classes and members with an @ syntax. How class, method, and field decorators work, with real examples.
Takina · · 4 min read TypeScript utility types like Partial, Pick, Omit, and Record transform existing types instead of redeclaring them. How the common ones work, with examples.
Takina · · 4 min read TypeScript generics let functions and types work with any type while preserving the specific type used at each call site, avoiding both duplication and any.
Takina · · 5 min read Microsoft shipped TypeScript 7.0 with a Go-native compiler that's roughly 10x faster than 6.0. What changed, what breaks, and how to upgrade.
Takina · · 3 min read TypeScript adds a safety net to JavaScript without slowing you down. Here's how to set it up, the handful of concepts that matter, and how to adopt it gradually.