Better HN
topnewbestaskshowjobs
Log inSign up

emyrk

39 karma · joined Oct 27, 2021 (5y ago) · 5 submissions

Submissions

comment 1y ago · link · parent

I know there exists more generic typing tools. One idea I had was to make a "guts" to convert Golang -> Generic Typing -> All languages.

The reason to keep Golang as the source of truth is these types originate from the backend. So when you are writing the backend, it is just the easiest place to write and maintain things. No obstacles.

Golang types are also very simple. I imagine almost all Go types can be converted because of that.

comment 1y ago · link · parent

Using Golang as the source is easier for a Golang backend team. Native types are always going to be the most convenient.

The theory when we came out with guts was that Golang's typing system is very simple (this was before generics when it was made). So how hard could it be to write a simple converter?

The first iteration of guts was written in an afternoon. Eventually I moved it to its own repo, mainly for personal use.

So honestly it really comes down to making it as easy as possible to write backend code. Using another spec that autogen's the Golang would be an extra step we did not feel we needed.

comment 1y ago · link · parent

Thrilled to see you got value out of it!

comment 1y ago · link · parent

I totally agree a proto first approach to your types can pay back in dividends if you need to serialize over different wires.

This project admittedly was developed to solve a specific need in an existing codebase with a lot existing types.

The codebase is also mostly maintain by the backend Golang engineers. Letting them use their native type system increases adoption and buy in.

5.

Show HN: Guts – convert Golang types to TypeScript(github.com ↗)

105 points · by emyrk · 1y ago · 30 comments