Skip to content

Commit b2fa9f6

Browse files
authored
Merge pull request #132 from ty-ras/issue/129-qol-typings-to-endpoint-args
#129 QoL improvements to typings of endpoint args…
2 parents f234279 + 4d81876 commit b2fa9f6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

endpoint-spec/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ty-ras/endpoint-spec",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"author": {
55
"name": "Stanislav Muhametsin",
66
"email": "[email protected]",

endpoint-spec/src/api.types/url.types.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ export type GetMethodArgsGeneric<
393393
TProtocolSpec extends protocol.ProtocolSpecCore<protocol.HttpMethod, any>,
394394
TStateSpec,
395395
> = {
396-
context: TServerContext;
397396
state: dataBE.MaterializeRuntimeState<TStateHKT, TStateSpec>;
398-
} & (TProtocolSpec extends protocol.ProtocolSpecURL<infer TURLData>
399-
? { url: protocol.RuntimeOf<TURLData> }
400-
: {}) &
397+
} & (never extends TServerContext ? {} : { context: TServerContext }) &
398+
(TProtocolSpec extends protocol.ProtocolSpecURL<infer TURLData>
399+
? { url: protocol.RuntimeOf<TURLData> }
400+
: {}) &
401401
(TProtocolSpec extends protocol.ProtocolSpecQuery<infer TQuery>
402402
? { query: protocol.RuntimeOf<TQuery> }
403403
: {}) &

endpoint-spec/src/implementation/app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ function newBuilderGenericImpl<
303303
? processMethodArg
304304
: (pArgs) => {
305305
const boundMethod = processMethodArg(pArgs) ?? pArgs.boundMethod;
306-
return ({ context: _, ...args }) => boundMethod(args as any); // eslint-disable-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars
306+
return (args) => boundMethod(data.omit(args, "context" as any) as any); // eslint-disable-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars
307307
};
308308
// Define resetMetadataProviders separately, as defining it inline causes problems with function overload having different argument count.
309309
const resetMetadataProviders: api.ApplicationBuilderGeneric<

0 commit comments

Comments
 (0)