[{"data":1,"prerenderedAt":372},["ShallowReactive",2],{"project-43682547":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":43,"post_text":45,"what":46,"said":61,"maker_in_thread":147,"shape":155,"grid":160,"attempts":333,"same_week":334,"maker_shows":42,"maker_hidden":364,"reader_version":365,"card":366},"43682547","protobuf-ts-types","Zero-codegen, no-compile TypeScript type inference from Protobufs","title","Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs","https:\u002F\u002Fgithub.com\u002Fnathanhleung\u002Fprotobuf-ts-types","github.com","18nleung",1744645263,2025,138,73,542,3837,15,"notable","languages","type system library","library",[24,25,26,27],"typescript","protobuf","type inference","codegen","debated",0.108,{"positive":31,"neutral":32,"mixed":33,"critical":34},7,4,0,6,17,{"idea":37,"performance":39,"execution":41},{"positive":38,"critical":38},2,{"positive":33,"critical":40},3,{"positive":38,"critical":42},1,[33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,44,42,33,40,44,42,40,33,44,40,40,33,33,33,33,33,42,33,44,42],5,null,{"problem":45,"audience":45,"pricing":45,"motivation":45,"time_to_build":45,"stack":47,"openness":60,"stage":60,"team_size":60},[48],{"value":49,"source":50,"evidence":51},"TypeScript","inferred",[52,56],{"id":53,"by":54,"text":55},"43683256","mubou","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…",{"id":57,"by":58,"text":59},"43685600","pragma_x","What's kind of amazing is that Typescript's matching of strings through the type system converges on a first-class PEG in a few places (see string.ts). The rest of the library is…","unknown",{"praise":62,"objections":84,"requests":115,"questions":124,"alternatives":133},[63,73],{"value":64,"source":65,"evidence":66},"Impressive use of TypeScript's type system; small, succinct source.","commenter",[67,68,69],{"id":53,"by":54,"text":55},{"id":57,"by":58,"text":59},{"id":70,"by":71,"text":72},"43684474","aappleby","This is both hilarious and awesome. I think the Typescript devs are just showing off at this point. :D",{"value":74,"source":65,"evidence":75},"Cool zero-codegen approach that removes build steps.",[76,80],{"id":77,"by":78,"text":79},"43690979","anjandutta","This is super cool — love the zero-codegen approach. I’ve had to deal with codegen hell in monorepos where a tiny .proto change breaks half the pipeline. Curious how this handles…",{"id":81,"by":82,"text":83},"43683429","throwanem","I love this, and I bet the compile errors it produces on malformed protobuf are wild.",[85,100],{"value":86,"source":65,"evidence":87},"Inline string only; the schema can't be read from .proto files due to TypeScript limits.",[88,92,96],{"id":89,"by":90,"text":91},"43684035","recursive","This requires the whole `.proto` declaration inline in source a string constant. I'm not holding my breath on \"Import non-js content\"[1] getting approved, so that means you still…",{"id":93,"by":94,"text":95},"43683333","tim1994","It's always impressive how far people can take TypeScript and even build parsers with it. But this is limited to inlined string literals and cannot read files (a TS limitation).…",{"id":97,"by":98,"text":99},"43683932","porridgeraisin","Cool. Once the linked TS issue is resolved it will be able to resolve from files too which is great",{"value":101,"source":65,"evidence":102},"Likely slow compile times and poor error messages from heavy type-level computation.",[103,107,111],{"id":104,"by":105,"text":106},"43686306","mherkender","This is kinda why I hate advanced type systems, they slowly become their own language. \"No compile\u002Fno codegen\" sounds nice until you get slow compile times because a type system…",{"id":108,"by":109,"text":110},"43686685","jitl","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…",{"id":112,"by":113,"text":114},"43683160","jillyboel","Cool, but I assume not great for performance? Probably better to just stick with codegen",[116,120],{"value":117,"source":65,"evidence":118},"Support for nested messages and oneof fields.",[119],{"id":77,"by":78,"text":79},{"value":121,"source":65,"evidence":122},"Support for importing non-JS file content in TypeScript.",[123],{"id":89,"by":90,"text":91},[125,129],{"value":126,"source":65,"evidence":127},"What is the use case, given protobuf is needed for non-TS interop?",[128],{"id":93,"by":94,"text":95},{"value":130,"source":65,"evidence":131},"Is it fast enough for performance and IDE use?",[132],{"id":112,"by":113,"text":114},[134,139],{"value":135,"source":65,"evidence":136},"Traditional protobuf codegen tools.",[137,138],{"id":112,"by":113,"text":114},{"id":89,"by":90,"text":91},{"value":140,"source":65,"evidence":141},"Generating proto from TypeScript types or TypeSpec.",[142,143],{"id":108,"by":109,"text":110},{"id":144,"by":145,"text":146},"43687067","mifydev","This makes me wonder if this the way to do schema generation in Typescript. I’m working on Typeconf, and we have a separate step for translating Typespec schema to Typescript,…",{"comments":38,"answered":42,"key":148},[149,152],{"id":150,"text":151},"43683286","I would have written a shorter source, but I did not have the time.",{"id":153,"text":154},"43683281","You're right that IDE\u002Fdev-time performance might be slower than using generated types since this relies on \"dynamic\" TypeScript inference rather than static codegen'd types. That…",{"commenters":156,"max_depth":157,"maker_replies":38,"first_comment_mins":158,"lifespan_hours":159},37,14,55,120,[161,163,165,169,171,175,177,180,182,185,187,189,191,193,195,198,201,204,206,209,211,213,216,218,221,225,227,229,231,234,236,238,240,243,246,249,252,254,257,259,262,263,265,266,267,271,273,275,278,280,282,284,287,291,294,296,299,302,305,307,309,311,313,315,318,320,324,327,329,330],[53,33,33,162,54,33],"commenter\u002Fcritical\u002Fidea",[150,33,33,164,11,42],"maker\u002Fneutral\u002Fnone",[166,33,33,167,168,33],"43683291","other\u002Fneutral\u002Fnone","sgrove",[170,33,33,167,54,33],"43683413",[172,33,33,173,174,33],"43686886","commenter\u002Fneutral\u002Fnone","IshKebab",[176,33,33,167,82,33],"43683453",[178,33,33,173,179,33],"43684901","NoTeslaThrow",[181,33,33,173,82,33],"43684981",[183,33,33,173,184,33],"43690171","antonvs",[186,33,33,173,82,33],"43690496",[188,33,33,173,184,33],"43723116",[190,33,33,167,82,33],"43725134",[192,33,33,173,184,33],"43730688",[194,33,33,167,82,33],"43737006",[196,33,33,167,197,33],"43684453","plopz",[199,33,33,173,200,33],"43684576","rad_gruchalski",[202,33,33,167,203,33],"43685355","spankalee",[205,33,33,167,54,33],"43685613",[207,33,33,167,208,33],"43686070","merb",[210,33,33,167,203,33],"43686125",[212,33,33,167,54,33],"43687401",[214,33,33,167,215,33],"43687408","p1necone",[217,33,33,167,54,33],"43687457",[219,33,33,167,220,33],"43690105","Timon3",[222,33,33,223,224,33],"43696099","other\u002Fcritical\u002Fnone","yencabulator",[226,33,33,173,220,33],"43696308",[228,33,33,167,224,33],"43696579",[230,33,33,167,220,33],"43696944",[232,33,33,233,224,33],"43697169","commenter\u002Fcritical\u002Fnone",[235,33,33,173,220,33],"43697382",[237,33,33,173,224,33],"43697436",[239,33,33,173,220,33],"43697520",[241,33,33,173,242,33],"43700332","neonsunset",[244,33,33,167,245,33],"43687449","rtpg",[247,33,33,167,248,33],"43693616","sandreas",[250,42,44,251,203,33],"43684335","project\u002Fpositive\u002Fidea",[108,38,42,253,109,33],"project\u002Fcritical\u002Fperformance",[255,38,40,164,256,33],"43686709","tantalor",[258,38,33,167,109,33],"43687517",[260,38,33,167,261,33],"43690692","h1fra",[104,40,42,253,105,33],[81,32,44,264,82,33],"project\u002Fpositive\u002Fexecution",[57,44,44,264,58,33],[112,34,42,253,113,33],[268,34,40,269,270,33],"43683218","project\u002Fneutral\u002Fperformance","dtech",[272,34,40,269,113,33],"43684110",[153,34,33,274,11,42],"maker\u002Fneutral\u002Fperformance",[276,34,33,277,90,33],"43684065","commenter\u002Fneutral\u002Fperformance",[279,34,33,277,113,33],"43684120",[70,31,44,281,71,33],"project\u002Fpositive\u002Fnone",[77,283,44,281,78,33],8,[89,285,42,286,90,33],9,"project\u002Fcritical\u002Fexecution",[288,285,40,289,290,33],"43685096","project\u002Fneutral\u002Fnone","cadamsdotcom",[292,285,33,167,293,33],"43685360","ZitchDog",[295,285,33,173,90,33],"43686124",[297,285,33,173,298,33],"43686343","catapart",[300,285,33,173,301,33],"43687328","phpnode",[303,285,33,173,304,33],"43688661","bastawhiz",[306,285,33,173,301,33],"43690405",[308,285,33,173,304,33],"43691786",[310,285,33,173,301,33],"43696658",[312,285,33,173,304,33],"43701370",[314,285,33,173,301,33],"43703481",[316,285,42,317,224,33],"43696131","project\u002Fcritical\u002Fidea",[144,319,33,167,145,33],10,[321,322,33,167,323,33],"43684540",11,"meindnoch",[325,326,44,281,298,33],"43686226",12,[97,328,44,251,98,33],13,[93,157,42,317,94,33],[331,18,33,167,332,33],"43688238","nikolayasdf123",[],[335,340,345,350,355,359],{"id":336,"name":337,"points":338,"category":339},"43690289","Unsure Calculator",930,"dev_tools",{"id":341,"name":342,"points":343,"category":344},"43675248","SignalBloom",292,"finance_crypto",{"id":346,"name":347,"points":348,"category":349},"43667061","memEx",194,"productivity",{"id":351,"name":352,"points":353,"category":354},"43652968","Chonky",169,"ai",{"id":356,"name":357,"points":358,"category":20},"43677909","Infocom Unix Z-Machine (pez)",157,{"id":360,"name":361,"points":362,"category":363},"43689178","MCP-Shield",134,"security_privacy",false,"v2",{"id":367,"name":5,"line":6,"ai":364,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":368,"top":18,"kw":369,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":370,"url":9,"mix":371,"praise":64,"objection":86,"sub":21},43682547,0.11,[24,25,26,27],"0000000000000000000051035130533000001051",[31,32,33,34],1794036672869]