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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Gen-ts-type – Code Generate TS Type from JSON data with collapsed field

1 点作者 aabbcc12414 天前
I built a tool to generate TypeScript types from JSON&#x2F;JS data, initially to tackle the deeply nested arrays in for a few JSON RPC API (e.g., array[0].content.section.contents[0].item.contents[0] could be a aItem or bItem). Some existing tools generate named union types at every level, which can get messy. This tool automatically converts fields to optional at the right depth, making the types cleaner and easier to use.<p>Features: - Web UI: Paste JSON, get TypeScript types instantly - CLI or importable in TypeScript projects - Handles complex types (nested objects, arrays, etc.) - Supports optional fields and union types where needed<p>Try the Web UI: <a href="https:&#x2F;&#x2F;gen-ts-type.surge.sh" rel="nofollow">https:&#x2F;&#x2F;gen-ts-type.surge.sh</a><p>Also published on github and npm as gen-ts-type<p>Feedback welcome!

暂无评论

暂无评论