Hacker News new | ask | show | jobs
by timostamm 1419 days ago
Not sure if it is a magic bullet, but it was definitely written by TypeScript developers, for TypeScript developers.

The generated TypeScript code is already pretty minimal because all serialization ops are implemented with reflection instead of generated code (which is only marginally slower than generated code in JS).

But you can also switch to generating JavaScript + TypeScript declaration files, which is truly minimal: JavaScript is an entire dynamic language, so we actually only generated a small snippet of metadata in the .js output, and create a class at run time with a function call. The generated typings (.d.ts) give you type safety, autocompletion in the IDE, and so on.

You can see the output here: https://github.com/bufbuild/protobuf-es/blob/main/packages/p...