Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Build a Recursive JSON-to-TypeScript Interface Generator in 60 Lines (Zero Dependencies)

Every TypeScript developer has pasted an undocumented REST API payload into an editor and started manually typing interface ApiResponse { ... } . Most quick "JSON to TypeScript" snippets you find online only inspect the first item of an array and run naive typeof value checks. On real production APIs, that immediately breaks in four ways: Optional properties disappear: Item 0 does not have…

Every TypeScript developer has manually typed interfaces for API responses in the past. Most online "JSON to TypeScript" snippets only look at the first item of an array and perform naive typeof value checks. However, real production APIs break quickly in four ways: optional properties disappear, nullable fields become problematic, hyphenated keys cause syntax errors, and nested objects merge or become unreadable.

This article explains how to create a clean, recursive JSON-to-TypeScript interface generator in just 60 lines of zero-dependency TypeScript that handles all four edge cases properly. The approach combines naive typeof inference with merged schema inference to produce accurate TypeScript interfaces.

The module operates in pure TypeScript and can run in any environment without requiring any npm dependencies. It defines a regular expression for valid identifier names, a function to convert keys to PascalCase, and a function to format keys for TypeScript syntax. The main function, jsonToTypeScript, takes the input data and an optional root name, and returns a string containing the generated TypeScript interfaces.

It utilizes two helper functions, infer and inferArray, to recursively analyze the input data and infer the appropriate TypeScript types.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

My three small sites have 2,307 referring domains. 899 of the top 900 are spam, and Google has not penalised any of them.

I run three small sites: AllSmartCalculators (finance, education and health calculators), 360 PlayZone (browser games that need no sign-up) and ResumeBanao (a resume builder and ATS checker for Indian…

  • The reporter owns three small websites: AllSmartCalculators, 360PlayZone, and ResumeBanao.
  • 2,307 referring domains total across the three sites, with 899 of the top 900 marked as spam.
  • Despite the spammy links, Google has not penalized any of the sites according to the reporter.

Supabase CLI 3.4.0: new projects get config.jsonc, not config.toml

Since Supabase CLI v3.4.0 , released on 24 November 2026, supabase init creates supabase/config.jsonc for new projects instead of supabase/config.toml .

  • New projects now use supabase/config.jsonc instead of supabase/config.toml
  • TOML file remains supported for existing projects without issues
  • CLI v3.1.0 first to read new config.jsonc file

Why I split a simulation engine from its renderer (and what it bought me)

When you build a simulation with a graphical front end, the temptation is to let the world and its drawing live together. It is faster at first.

  • LIVEX splits simulation engine (SYNE) from rendering module (PRISM)
  • SYNE serves as simulation's single source of truth
  • Replayability and cheaper tests achieved by decoupling layers

Typesense Tutorial: Search That Forgives Typos Fast

Quick answer Typesense is an open-source search engine that runs as one small server and forgives typos out of the box: a shopper who types "kurtah" still finds the kurta.

  • Typesense auto-forges typos in search results
  • Single binary setup for easy deployment
  • Suitable for small to medium catalogues

Kubernetes CrashLoopBackOff: Top 6 Causes & 30-Second Fix Checklist

CrashLoopBackOff is not an error itself—it is Kubernetes telling you that a container inside your Pod keeps starting, crashing, and waiting for an exponential backoff delay (10s, 20s, 40s, up to 5…

  • CrashLoopBackOff indicates container repeatedly fails and restarts
  • Top causes: memory limits, missing env vars, liveness probes
  • Fix by adjusting limits, verifying configs, optimizing probes

More from Sunday, 29 November 2026 →