| ▲ | Show HN: Guts – convert Golang types to TypeScript(github.com) | ||||||||||||||||||||||
| 44 points by emyrk 2 hours ago | 8 comments | |||||||||||||||||||||||
| ▲ | flashgordon 2 hours ago | parent | next [-] | ||||||||||||||||||||||
I really like the idea of it. My dream has always been to work with "types" first and foremost across any and all languages (yep it is a dream). And little tools like these are really nice to see push that boundary. One feedback - if you are truly comparing with "other" tools - you should be looking at grpc and protoc plugins. I have used to great effect for things like: 1. Generating wasm bindings for grpc services 2. Generating "data access layer" types so you can choose how a api proto is transformed to a data domain type and vice versa 3. MCP bindings for APIs 4. GraphQL/BFF bindings with multiple services 5. All of the above "across" langauges. The tooling is fantastic and extensible - if you are ok to start with a proto view of your world - it sounds wierd and like an N+1 problem but once you are used to it it is surprisingly fun (ok we may have different ideas of fun) | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | cube2222 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
We've been using guts basically since it was published on GitHub (almost a year now), and it's so nice! We have a "custom POST-based JSON-rpc"-style api, so we have request and response bodies defined as Go types, and are generating the whole TS schema from it. It basically lets you generate typescript types from your Go types. However, it's very customizable - you can post-process the AST. In our case, we have a custom generic Go type that indicates an optional (not nullable) field, and we can easily translate it to optional TS types (e.g. for sparse updates). All in all, great tool/library, thanks for building it! Disclaimer: I know a developer at Coder (not the author), who also recommended me guts back then, but am unaffiliated other than that. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | PhilippGille an hour ago | parent | prev | next [-] | ||||||||||||||||||||||
There's also https://github.com/tkrajina/typescriptify-golang-structs Which is used for example in the Go GUI framwork Wails: https://github.com/wailsapp/wails/tree/v2.11.0/v2/internal/b... | |||||||||||||||||||||||
| ▲ | zikani_03 2 hours ago | parent | prev [-] | ||||||||||||||||||||||
Nice, this looks interesting. Somewhat related is a project we worked on within Golang community in Malawi: https://github.com/golang-malawi/geneveev It supports converting types to Zod schemas and Dart classes. Never got around to TypeScript and would be cool to see if we could add support for guts | |||||||||||||||||||||||