Live data from Hacker News

Show HN: A SQL database implemented purely in TypeScript type annotations

github.com

191–196 of 196 posts

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#191
post #164

Earlier quoted context omitted.

my thoughts as well. compile-time checked arbitrary sql would defeat the purpose of so many abominable ORMs. make it work with DDL instead of sample data and you've really got something nice!

This project does exactly that (TypeScript/PostgreSQL): https://github.com/MedFlyt/mfsqlchecker

That looks pretty nice. I’ll have to check that out.

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#193

JavaScript is such a cool language, and I really love it, especially the FP subcommunity, but the AI community for Python is way bigger, I wish there were more options for neural nets, differentiable programming, and data frame type things in JS. The interoperability with WASM is hugely valuable, and so is the ability to easily publish results on the web. It feels like it’s way easier to make an AI system in python,…

I think you're talking about two different systems and two different problems. First, there's the core service code, the AI system in Python you're talking about. Then, there's the web platform or service that you monetize. But there's no reason why you wouldn't just use both. Write the core AI code in Python because that's what's practical to do. Write the app code in JS because that's what's practical to do. Sell t…

In my opinion it would be great to have a single language for developer productivity. Backend and frontend can be already written fully in TypeScript and you can share interfaces between frontend and backend so everything is connected and business logic is not repeated. Same thing could be done for machine learning.

If backend changes frontend has to change as well or compiler will yell. Same for machine learning input and output.

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#194
post #118

Earlier quoted context omitted.

From years of real-world experience, it's rare to run into types that are too complex to easily understand. The syntax is pretty easy to read, and the compiler and language service make it easy to navigate types, even if you haven't looked at the source for them yet.

FWIW I find that TypeScript types can sometimes be overwhelming or hard to decipher, especially some third-party library type definitions. The connect function from react-redux is one example: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d07d... Since types can get really complex, I feel a need to be conscious of avoiding complexity when writing types myself, unless the value is enough to justify a hard-to…

Many complex/difficult to understand TS types exist precisely because the type system was too limited to express certain real world use cases without workarounds. As the type system takes on that complexity, and removes more limitations, it actually makes writing simpler types for those cases much easier.

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#195

Earlier quoted context omitted.

I was thinking about this the other day i would love for TS flag that would turn an interface into an assert const shout = (message: string) => console.log(message) into something like const assert = require('assert'); const shout = (message) => { assert(typeof message === "string"); console.log(message); } of course this doesn't work for more complicated types

You should checkout myzod, which is very close to this experience.

Thanks for this

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#196

Earlier quoted context omitted.

Another potential benefit - runtime metaprogramming. All types are erased when converted to JS, but I can imagine a lot of utility for runtime types in Typescript.

Obligated mention of runtypes ( https://github.com/pelotom/runtypes ) that bridges the gap between type-land and runtime-land. It's not seamless at all but if you have a serious need for this sort of thing, it's great

Not quite the same, but reminds me a bit of yup (https://github.com/jquense/yup)!
Post reply on HN