Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
1–10 of 80 posts
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#2Probably better to just stick with codegen
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#3Cool, but I assume not great for performance? Probably better to just stick with codegen
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#4On the other hand, the fact that this is even possible is more wild. Instead of replacing JS with a proper statically-typed language, we're spending all this effort turning a preprocessor's type system into a turing-complete metalanguage. Pretty soon we'll be able to compile TypeScript entirely using types.
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#5Cool, but I assume not great for performance? Probably better to just stick with codegen
That said, depending on how your codegen works and how you're using protos at runtime, this approach might actually be faster at runtime. Types are stripped at compile-time and there’s no generated class or constructor logic — in the compiled output, you're left with plain JS objects which potentially avoids the serialization or class overhead that some proto codegen tools introduce.
(FWIW, type inference in VSCode seemed reasonably fast with the toy examples I was playing with)
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#6The fact that the source is so small is wild. I would have expected a huge convoluted parsing library implemented in types. On the other hand, the fact that this is even possible is more wild. Instead of replacing JS with a proper statically-typed language, we're spending all this effort turning a preprocessor's type system into a turing-complete metalanguage. Pretty soon we'll be able to compile TypeScript entirely…
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#7The fact that the source is so small is wild. I would have expected a huge convoluted parsing library implemented in types. On the other hand, the fact that this is even possible is more wild. Instead of replacing JS with a proper statically-typed language, we're spending all this effort turning a preprocessor's type system into a turing-complete metalanguage. Pretty soon we'll be able to compile TypeScript entirely…
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#8I wonder if the author has a use case in mind for this that I don't see. Like if you are only using TS, what's the point of protobuf? If you are exchanging data with programs written in other languages why avoid the protobuf tooling that you need anyway?
Maybe this is just a fun toy project to write a parser in TS?
Re: Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
#9The fact that the source is so small is wild. I would have expected a huge convoluted parsing library implemented in types. On the other hand, the fact that this is even possible is more wild. Instead of replacing JS with a proper statically-typed language, we're spending all this effort turning a preprocessor's type system into a turing-complete metalanguage. Pretty soon we'll be able to compile TypeScript entirely…
Or even run doom in TypeScript's type system!