TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: TypeScript query builder with full type inference

4 点作者 colinmcd将近 3 年前
Hey HN! Colin here - a TypeScripter, open sourcer, and engineer at EdgeDB. As the creator of Zod and tRPC, I&#x27;m interested in designing tools&#x2F;APIs that use type inference and generics to make life easier for devs. This query builder represents another step in that direction.<p>We set out to build an EdgeQL query builder that can express queries of arbitrary complexity (EdgeQL has feature parity with SQL, roughly) and infer the static type of the query result. We introspect the database and generate a schema-aware client that represent any query, including ones that use built-in functions, operators, string&#x2F;array&#x2F;tuple indexing, aggregations, conditionals, type casting, subqueries, computed properties, etc—things most ORMs can’t represent.<p>This post mostly discusses the API design, which I think will be interesting regardless of familiarity with EdgeQL. I’d love to see some of these ideas bleed into future generations of TypeScript ORMs&#x2F;query builders too.<p>Best way to try it is to clone the sandbox repo and follow the instructions in the README[0]. Or jump into the docs[1].<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;edgedb&#x2F;mcu-sandbox" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;edgedb&#x2F;mcu-sandbox</a><p>[1] <a href="https:&#x2F;&#x2F;www.edgedb.com&#x2F;docs&#x2F;clients&#x2F;js&#x2F;querybuilder" rel="nofollow">https:&#x2F;&#x2F;www.edgedb.com&#x2F;docs&#x2F;clients&#x2F;js&#x2F;querybuilder</a>

暂无评论

暂无评论