Skip to content

Feature request: call a procedure by passing its contract for better TS performance #1393

@jedwards1211

Description

@jedwards1211

Describe the feature

I’ve been pretty happy with my new oRPC app and really appreciating your hard work on this framework! But TS performance with intellisense, autoimports and rechecking is pretty bad in my project. I think a lot of this is due to the app router being one giant type that requires TS to do a bunch of inference across many files to construct. Having my output types coming from drizzle probably makes this a lot worse, I do need to see if declaring explicit output schemas fixes this.

I looked at contract routing but I was disappointed that the client API still seems to rely on one big app router type in that case.

If we could specify the full url path on each contract, then we could make a request on the client by passing in just a contract and input data, instead of relying on a recursive proxy to build the url path from the root of a big app router type. Then I think performance would be way better, because each client module would only need to import the contracts it uses and TS would only have to extract the input, output and error types from those contracts.

Some people might not prefer the developer experience of needing to figure out which contract to import instead of having all the methods right there on one type. But I think the performance benefits would be worth it. Plus, if we can specify the URL path on each contract, it would make it possible to support URL path parameters for a conventional REST API.

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions