Hacker News new | past | comments | ask | show | jobs | submit | johnmorrison's comments login

people are indeed working on -1,0,1,2 Q2 models, I read something about it the other day but don't recall the title.

they mentioned decomposition of Q2 into ternary+binary i.e. [[1,2],[-1,0]] -> [[1,1],[0,0]] + [[0,1],[-1,0]]


This is very cool to see! We've been building something very similar (in some regards, very different in others) in https://rysana.com/bundown

Somehow ideas like this emerge in waves seemingly with no coordination, kind of like what happened when Calculus was first invented

(Of course there's a lot of prior art here but it's interesting to see a specific jump towards polyglot single-file Markdown 'apps' and so on happen around the same time)


I love this game, got pretty into it around 2016/17 and rose to the top of the global 1v1 leaderboard for a while. Really cool to see it still running :D


> the public seems to demand exactly this from AI

No, not "the public", this is a small vocal minority.


I love tRPC, it's by far the best fullstack DX I've ever seen and has such a brilliant API especially when combined with Zod.

Zod and tRPC are some of the most important projects in the future of TS imho, I think we're gonna see a beautiful bloom of tRPC inspired DX across the TS space in coming years.

Two projects already have clearly have tRPC DNA attacking different use cases are Ping's UploadThing (https://github.com/pingdotgg/uploadthing) and our Lusat (https://github.com/lusatai/lusat).


I don’t really like Zod at all, it has very finicky and verbose types/generic params and it’s object generic won’t allow you to pass a data type, but instead you must pass zods own schema types as properties which are very messy and unintuitive.

Another annoyance is that the type of validation errors varies depending on what kind of schema you’re checking against. This makes it unpredictable to handle errors and there’s always too many edge cases.

Lots of room for improvement.


I don't disagree (not that I feel the same level of annoyance, on balance I love Zod for the time it saves me) but what would you recommend as an alternative?

The new valibot.dev looks cool but I haven't tried it yet.


Just took a quick glance at the source[0] and the generic type for an object schema is a record of other schemas too, similar to Zod. At least that irk won't be solved by this and for me at least it’t the biggest one because it makes typing a function with generic data that includes a schema that acts upon it unnecessarily difficult.

[0] https://github.com/fabian-hiller/valibot/blob/e6c53c8a4b0033...


I also recent did a personal project that uses tRPC and Zod and I agree that it was a fantastic experience. It also makes writing unit tests way easier.


Do you know of anything in this region for MongoDB? The two big problems there seem to be type-safe data CRUD, but also migration of data. I see people referencing Mongoose a lot, but that seems like it's a big downgrade from Zod/TS in terms of type safety.


I've never used it for Mongo, but Prisma is a pretty great type-safe ORM that supports Mongo: https://www.prisma.io/docs/getting-started.


Zod is...so freaking great. I'm feeling kind of hyperbolic at the moment, so I'll even go so far as: for a certain style of programming, adding Zod to a codebase is as big of a win as adding TypeScript.


Absolutely. Zod is to the runtime what TypeScript is to the IDE.


I would also recomment effect/core + effect/schema, the pattern of creating typed services starting from schemas is there perfect for people that are more functional-programming leaning.


I saw that a while back, but it seems like a large learning curve and I don't immediately feel much drawing me towards it. Will be keeping an eye on it anyhow.


I just checked out the Zod intro pages but I still don’t know what problem it’s trying to solve. What is it adding to TypeScript (which I am not conversant in either)?

Thanks for any insight!


runtime


"Runtime" is not a problem.


TypeScript-first schema validation with static type inference


There you go.

But schemas for what?


> Schema validation provides assurance that data is strictly similar to a set of patterns, structures, and data types you have provided. It helps identify quality issues earlier in your codebase and prevents errors that arise from incomplete or incorrect data types.

From: https://blog.logrocket.com/schema-validation-typescript-zod/

Most common use case I’ve seen is using schema validation for user input (like forms) so you don’t send junk off to the api, you can validate data at runtime (whereas typescript checks your types statically when compiled).


Thanks for the reply! I know what schema validation is, but didn't see what kind of schemas Zod was intended for. In other words, what is it parsing? That post you linked to looks very informative.


I wrote a reply but then I found this and it’s a perfect explainer: https://www.totaltypescript.com/when-should-you-use-zod

Matt is awesome! If you have any more questions I’ll do my best to answer them.


Thank YOU Alex!

This project has done incredible things for TypeScript


This is truly incredible, I love it. I customized it a lot, changed just about every setting, and now I'm left with a beautiful minimal experience:

   <   domain.com   >   
Long tap URL for settings, short tap for search, and navigation. Hide status bar in tabs & toolbar on scroll. Fullscreen de facto. Love it.


Thanks a lot! I'm so glad you managed to create a minimal toolbar that works great for you :-)


This is brilliant news and frankly should be the global default for headings if we were to start over - hopefully browsers will adapt this ASAP.


US citizens only according to website. Presumably due to Government usage.


All New York City on-site according to their site.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: