Immediately after switching the page, it will work with CSR.
Please reload your browser to see how it works.

Source:https://github.com/SoraKumo001/next-streaming

⬅️ Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs
mubou 2 daysReload
The 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 using types.


spankalee 2 daysReload
This would be even nicer if TypeScript added type inference for tagged template literals, like in this issue [1]. Then you could write:

    const schema = proto`
      syntax = "proto3";

      message Person { ... }
    `;

    type Person = typeof schema['Person'];
And you could get built-in schema validation with a sophisticated enough type definition for `proto`, nice syntax highlighting in many tools with a nested grammar.

We would love to see this feature in TypeScript to be able to have type-safe template in lit-html without an external tool.

The issue hasn't seen much activity lately, but it would be good to highlight this library as another use case.

[1]: https://github.com/microsoft/TypeScript/issues/33304


jitl 2 daysReload
It’s pretty rad how flexible template literal types are, but I can’t imagine wanting this kind of shenanigans hanging out in a production app slowing down compile times. I prefer to define types in TypeScript and generate proto from that, since the TypeScript type system is so much more powerful than the Protobuf system. Types are much more composable in TS.

mherkender 2 daysReload
This is kinda why I hate advanced type systems, they slowly become their own language.

"No compile/no codegen" sounds nice until you get slow compile times because a type system is slow VM, the error messages are so confusing it's hard to tell what's going on, and there's no debugging tools.


throwanem 2 daysReload
I love this, and I bet the compile errors it produces on malformed protobuf are wild.