frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Parse, Don't Validate – In a Language That Doesn't Want You To

https://cekrem.github.io/posts/parse-dont-validate-typescript/
18•fagnerbrack•1h ago

Comments

robertlagrant•51m ago
This feels right, and I also have never done it (or had the guts to get others to do it).

The reason I've not is - say there's an optional field. Currently we call that null, probably, and check each time if it's there or not. I could instead make a type, like User and UserWithPhoneNumber. Should we be making types for each combination of present/absent fields? That can't be right.

The classic answer is to move the logic inside the domain object, or have a helper function outside the object, so you aren't constantly checking for field presence/absence, but are instead writing the logic once and calling some code.

I'm not sure in practice types can help with this. But I'd love to be proven wrong.

pillmillipedes•35m ago
if a user with/without phone number are equally valid states to be then types won't help you much. I think it's more about writing

  class User{phone: ?PhoneNumber}
over

  class User{phone: ?string}.
xx_ns•32m ago
I think this is a slightly different problem. The absence of an optional field, if that's a legal state, is meaningful every time you use the type, so you encode it on the field: `phone: ValidPhoneNumber | null`. When it's not null you're still guaranteed a valid phone number. When it is null, that's a legal state you have to handle and which is domain logic, not validation you forgot to do.

The combinatorial explosion you're picturing only shows up if you make a separate type per combination of present fields, but you don't need to. An independent optional field stays one `T | null`. You only reach for distinct types when fields are correlated and present together because they represent a state, and then it's a discriminated union on a status field, which is N states, not 2^N.

conartist6•19m ago
Don't forget to freeze the objects

Time may be an illusion derived from quantum entanglement

https://www.thebrighterside.news/post/time-may-be-an-illusion-derived-from-quantum-entanglement/
1•Koshkin•19s ago•0 comments

Crossword Heatmap

https://arbourtrary.com/sketches/crossword-heatmap
1•surprisetalk•23s ago•0 comments

How to Earn a Billion Dollars

https://www.paulgraham.com/earn.html
1•lucamark•31s ago•0 comments

Pricing velocity is an ownership problem

https://www.solvimon.com/blog/pricing-velocity-is-an-ownership-problem
1•arnon•37s ago•0 comments

Queen. Sentence

http://brekke.com
1•gewgweweg•1m ago•0 comments

Show HN: Uniflow – a code skeleton so feature #50 looks like feature #1

https://github.com/splendidz/uniflow
1•splendidz•2m ago•0 comments

Show HN: Kinetic Merge – merge a refactored codebase and stay sane

https://github.com/sageserpent-open/kineticMerge
1•sageserpent•2m ago•0 comments

Auto Efficient: The Right Model for Every Request, Automatically

https://blog.kilo.ai/p/auto-efficient
1•Aireen5858•3m ago•0 comments

School Is a Fossil

https://moai.studio/blog/posts/school-is-a-fossil.html
1•ionwake•3m ago•0 comments

Compiling Agentic Workflows into LLM Weights

https://arxiv.org/abs/2605.22502
1•dipankarsarkar•3m ago•0 comments

What Happens If You Throw a Paper Airplane in Space?

https://www.jalopnik.com/2203058/what-happens-if-you-throw-paper-airplane-in-space/
1•megamike•4m ago•0 comments

People Who Will Thrive in the AI Age

https://www.theatlantic.com/ideas/2026/06/ai-open-ai-anthropic/687689/
1•johnhamlin•6m ago•0 comments

Mltrackr – ML experiment tracking in 2 lines, no server, no account

https://github.com/NaiaLorente/datalog
1•naialorente•8m ago•0 comments

Show HN: Is grep enough? A transparent benchmark for agentic code navigation

https://entelligentsia.github.io/is-grep-enough/
2•bonigv•9m ago•0 comments

Optimization tales with CockroachDB: the slow password reset flow

https://gaultier.github.io/blog/optimization-tales-cockroachdb-part1.html
1•broken_broken_•9m ago•0 comments

GitHub stats, turned into a World-Cup-style player card

https://gitfut.com
2•yunexx•11m ago•0 comments

A New Way to Blend Borrow Checking and Reference Counting

https://verdagon.dev/blog/ante-blending-borrowing-rc
1•surprisetalk•15m ago•0 comments

Schools are closed, records are broken. Let's talk heatwaves

https://www.not-ship.com/heatwaves/
1•speckx•17m ago•0 comments

What AI music tool has the best workflow?

1•melogen_studio•18m ago•0 comments

Finding the cause of minor contagious metadata corruption in exiv2

https://me.micahrl.com/blog/minor-contagious-corruption-exiv2/
1•mrled•21m ago•0 comments

Will machines replace humans? A chess grandmaster has thoughts

https://www.washingtonpost.com/opinions/2026/06/30/garry-kasparov-is-not-afraid-machines/
1•kator•22m ago•1 comments

Show HN: Fiwano – Unified API for WhatsApp, Instagram DM and Facebook Messenger

https://github.com/fiwano-com/fiwano-cookbook
2•rmnbb•22m ago•0 comments

Most rewrites serve the engineer, not the business

https://anatoliybabushka.com/blog/when-to-rewrite-working-code.html
1•bbsnly•23m ago•0 comments

Show HN: Ekbatan – Java persistence framework for event-driven systems

https://zyraz-io.github.io/ekbatan/
1•unikzforce•24m ago•0 comments

Show HN: Drag'n'drop OpenCode Config Generator

https://nenadg.github.io/opencode-configurator/
1•nenadg•24m ago•0 comments

Show HN: Munin – open-source headless HubSpot alternative

https://github.com/getmunin/munin
2•kman_85•24m ago•0 comments

SocOCRbench – An OCR benchmark for social science documents

https://noahdasanaike.github.io/posts/sococrbench.html
1•KnightHawk3•25m ago•0 comments

Whither – HTTP redirect service powered by Wikipedia

https://whither.link/
2•dopple•25m ago•1 comments

Show HN: AgentShare Agent Readiness – Scan and optimize your site for AI bots

https://chromewebstore.google.com/detail/agentshare-agent-readines/nimndnhajfkicbnipbfdkmgencjejjed
1•Anh_Nguyen_vn•26m ago•0 comments

I Spent a Week in a Hacker House

https://www.theatlantic.com/technology/2026/06/hacker-houses-ai-boom-san-francisco/687737/
2•samizdis•29m ago•0 comments