frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

A lightweight TypeScript library for assertion-based runtime data validation

https://github.com/nimeshnayaju/decode-kit
3•nayajunimesh•4h ago

Comments

nayajunimesh•4h ago
Most validation libraries like Zod create deep clones of your data during validation, which can impact performance in high-throughput applications. I built decode-kit to take a different approach: assertion-based validation that validates and narrows TypeScript types in-place, without any copying or transformation. Here's what the API looks like in practice:

import { object, string, number, validate } from "decode-kit";

// Example of untrusted data (e.g., from an API) const input: unknown = { id: 123, name: "Alice" };

// Validate the data (throws if validation fails) validate(input, object({ id: number(), name: string() }));

// `input` is now typed as { id: number; name: string } console.log(input.id, input.name);

When validation fails, decode-kit takes an equally thoughtful approach. Rather than being prescriptive about error formatting, it exposes a structured error system with an AST-like path that precisely indicates where validation failed. It does include a sensible default error message for debugging, but you can also traverse the error path to build whatever error handling approach fits your application - from simple logging to sophisticated user-facing messages.

The library also follows a fail-fast approach, immediately throwing when validation fails, which provides both better performance and clearer error messages by focusing on the first issue encountered.

I'd love to hear your thoughts and feedback on this approach.

US halts work on almost finished wind farm because national security

https://www.npr.org/2025/08/23/nx-s1-5513919/trump-stops-offshore-wind-renewable-energy
1•hvb2•1m ago•0 comments

IRL Brain Rot and the Lure of the Labubu

https://www.newyorker.com/culture/infinite-scroll/irl-brain-rot-and-the-lure-of-the-labubu
1•di_ev•8m ago•0 comments

4chan UK online safety act and trump

https://www.theverge.com/politics/764653/4chan-uk-online-safety-act-trump
1•net01•9m ago•1 comments

Narcissistic Abuse, C-PTSD, and the Cartesian OMES of Aneurothymic Victims

https://cristinagherghel.substack.com/p/narcissistic-abuse-c-ptsd-and-the
1•Neuropsychology•10m ago•0 comments

Neuralink 'Participant 1' Noland Arbaugh says his whole life has changed

https://fortune.com/2025/08/23/neuralink-participant-1-noland-arbaugh-18-months-post-surgery-life...
2•danielmorozoff•12m ago•1 comments

The Trauma of Gaslighting and Veridical Distortion

https://cristinagherghel.substack.com/p/the-trauma-of-gaslighting-and-veridical
1•Neuropsychology•12m ago•0 comments

Are we heading for a world where no one ever needs talk to another human being?

https://www.theguardian.com/global/commentisfree/2025/aug/24/are-we-heading-for-a-world-where-no-...
2•rapnie•27m ago•1 comments

I treated GPT as a prophet. It answered with a 740-page trilogy

https://www.scribd.com/document/894087480/The-Word-the-Name-the-Fire-Complete-Edition-with-The-Ev...
1•gptprophet•28m ago•1 comments

The SD Association has an official SD card format utility [Win/OS X/Linux]

https://www.sdcard.org/downloads/sd-memory-card-formatter-for-linux/
1•Almondsetat•28m ago•0 comments

How I made $1M without selling courses

https://www.alexwest.co/books
1•chameleon_zeon•30m ago•1 comments

Coinbase Mandates In-Person Orientation to Stop North Korean Hackers

https://www.businessinsider.com/coinbase-north-korea-threats-remote-work-2025-8
3•ianrahman•30m ago•2 comments

Isaac Asimov’s vision of the future on Letterman

https://www.youtube.com/watch?v=cIB1b_8hqB0
2•keepamovin•30m ago•0 comments

Show HN: BacklinkHelper – Chrome Extension to Automate Link Building

https://backlinkhelper.com
1•hugh1st•38m ago•0 comments

JRR Tolkien on how WWI inspired Lord of the Rings

https://www.youtube.com/watch?v=1JF_COdf5Zg
2•keepamovin•40m ago•0 comments

Delhi High Court Orders Sci-Hub, Libgen to Be Blocked in India

https://maktoobmedia.com/india/delhi-high-court-orders-sci-hub-libgen-to-be-blocked-in-india/
1•elashri•42m ago•0 comments

A messaging processing framework that works with Kafka, Pubsub etc.

https://handy-messaging-framework.github.io/handy-messaging4j-docs/
1•aronsajan•45m ago•0 comments

Bridging the Gap: How Smart Demand Management Can Forestall the AI Energy Crisis

https://www.goldmansachs.com/what-we-do/goldman-sachs-global-institute/articles/smart-demand-mana...
1•rbanffy•46m ago•0 comments

A Dubai Chocolate theory of the internet

https://www.searchengine.show/a-dubai-chocolate-theory-of-the-internet/
1•ZeljkoS•50m ago•1 comments

Show HN: LLM meme stickers I made for fun

https://df.fenx.work/llm-things/
1•haxfenx•50m ago•0 comments

Show HN: Stb_zip – header-only C ZIP parser, zero dependencies, fast

1•Forgret•53m ago•0 comments

Researchers use machine learning to improve the taste of Belgian beers

https://physicsworld.com/a/researchers-use-machine-learning-to-improve-the-taste-of-belgium-beers/
1•i7l•57m ago•0 comments

Ask HN: Do you prefer niche job board or generalist ones?

3•rrmdp•1h ago•0 comments

Israeli army database suggests at least 83% of Gaza dead were civilians

https://www.972mag.com/israeli-intelligence-database-83-percent-civilians-militants/
13•ciconia•1h ago•3 comments

The Incompleteness of Ethics

https://aeon.co/essays/what-godels-incompleteness-theorems-say-about-ai-morality
1•i7l•1h ago•0 comments

Looking for an Indie Hacker who ships. ₹80k–1L / month. IST remote

https://superform.co/dOj5IeO
1•profvyas•1h ago•1 comments

Should AI pay for web content? Early proposal (HCCP)

https://github.com/aidanmorgan/fypm
1•aidanmorgan•1h ago•1 comments

Shore: A Gleam TUI Framework Following the Elm Architecture

https://github.com/bgwdotdev/shore
1•TheWiggles•1h ago•0 comments

The Jargon File (1991)

https://jargon-file.org/archive/jargon-2.3.1.dos.txt
1•edent•1h ago•1 comments

Show HN: Publish Markdown – A tool to publish Markdown file in one click

https://publishmarkdown.com
1•dzky•1h ago•0 comments

The World's Smartest City Is a Tiny German Village

https://reasonstobecheerful.world/etteln-smartest-city/
2•fodmap•1h ago•0 comments