What building blocks should Meteor ship out of the box?

@mikaknu fair point, and my analogy was loose. tsc catches a wrong call at build time, a schema catches wrong data at runtime, and whatever comes over the wire can only be checked at runtime, so the two are complementary rather than interchangeable. What I meant was only the posture: in the box, documented, opt-in, never mandatory.

Your oRPC remark is a good one. I checked: @orpc/server has no TypeScript peer dependency (only ws and crossws), while tRPC requires typescript 5.7+. So a typed-method layer that works in plain JS and gives inference for free in TypeScript is a real option, and it fits Meteor better than anything that would make tsc mandatory. It is also roughly the shape Grubba27 sketched in his RFC last year (meteor/meteor#13725: bring your own validator, check by default, self-documenting methods). The last comment there is from February, your tRPC/oRPC angle would be a good reason to wake it up :wink:

And xet7’s link is the Rails side of the same story: gems going unmaintained is exactly why Rails 8 moved jobs, cache and auth into default gems owned by the Rails team :man_shrugging:

1 Like

I think oRPC and tRPC are excellent in their package API design and if meteor were to go in this direction, there are several learnings and primitives that I think meteor would like consider it its implementation. To name a few:

  • Standard schema compatible validators where input types can be inferred from the schemas
  • Infer output / return types from handlers
  • Typed errors across the the wire so that discriminating error types or exhaustive error handling on client is possible
  • Type aware middleware / context to accumulate types so there is no need for casting or any type of type coercion
  • Composability when declaring “routers” or rpc objects (similar to express router?)
1 Like