Repository navigation
Closed
Labels
⏭ major bump neededRequires a major version bump
Description
Describe the feature you'd like to request
Simplify routers and procedure types in order to:
- reduce
.d.ts-footprint (Context is duplicated everywhere) - improve TS perf
- allow design to be more happy for defining standalone procedures without a router
- nicer procedures when hovering / autocompletion
Describe the solution you'd like to see
- built procedures should just be a simple structure containing
_input_in,_output_out - instead of passing
TRouter extends AnyRouteraround everywhere, we should pass aroundTConfig - (procedures are not aware of the
TConfigonce "built") - when we create client helpers, we still need
TConfig, so when we first initializeTRPCClientwe first extractTConfigand pass through the decorator
Describe alternate solutions
not doing it
Additional information
Currently a built router looks something like this:
export declare const router0: import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
ctx: {};
meta: object;
errorShape: import("@trpc/server").DefaultErrorShape;
transformer: import("@trpc/server").DefaultDataTransformer;
}>, {
greeting: import("@trpc/server").BuildProcedure<"query", {
_config: import("@trpc/server").RootConfig<{
ctx: {};
meta: object;
errorShape: import("@trpc/server").DefaultErrorShape;
transformer: import("@trpc/server").DefaultDataTransformer;
}>;
_meta: object;
_ctx_out: {};
_input_in: {
who: string;
};
_input_out: {
who: string;
};
_output_in: typeof import("@trpc/server").unsetMarker;
_output_out: typeof import("@trpc/server").unsetMarker;
}, string>;
}>;Where after this, it'd look something like
export declare const router0: import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
ctx: {};
meta: object;
errorShape: import("@trpc/server").DefaultErrorShape;
transformer: import("@trpc/server").DefaultDataTransformer;
}>, {
greeting: import("@trpc/server").Procedure<"query", {
_input_in: {
who: string;
};
_output_out: undefined;
}, string>;
}>;👨👧👦 Contributing
- 🙋♂️ Yes, I'd be down to file a PR implementing this feature!
Reacted by Zafer Cesur, Martnart, Shun Kakinoki and Matt Kantor
Reacted by Zafer Cesur
Metadata
Metadata
Assignees
Labels
⏭ major bump neededRequires a major version bump
Activity
[-]feat: simplify types of `Router` and `Procedure`[/-][+][T-119] feat: simplify types of `Router` and `Procedure`[/+][-][T-119] feat: simplify types of `Router` and `Procedure`[/-][+]feat: simplify types of `Router` and `Procedure`[/+][-]feat: simplify types of `Router` and `Procedure`[/-][+]feat: simplify output types of `Router` and `Procedure`[/+]