Skip to content

Commit

Permalink
Merge pull request #132 from ty-ras/issue/129-qol-typings-to-endpoint…
Browse files Browse the repository at this point in the history
…-args

#129 QoL improvements to typings of endpoint args…
  • Loading branch information
stazz authored Feb 14, 2024
2 parents f234279 + 4d81876 commit b2fa9f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion endpoint-spec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ty-ras/endpoint-spec",
"version": "2.2.1",
"version": "2.2.2",
"author": {
"name": "Stanislav Muhametsin",
"email": "346799+stazz@users.noreply.github.com",
Expand Down
8 changes: 4 additions & 4 deletions endpoint-spec/src/api.types/url.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ export type GetMethodArgsGeneric<
TProtocolSpec extends protocol.ProtocolSpecCore<protocol.HttpMethod, any>,
TStateSpec,
> = {
context: TServerContext;
state: dataBE.MaterializeRuntimeState<TStateHKT, TStateSpec>;
} & (TProtocolSpec extends protocol.ProtocolSpecURL<infer TURLData>
? { url: protocol.RuntimeOf<TURLData> }
: {}) &
} & (never extends TServerContext ? {} : { context: TServerContext }) &
(TProtocolSpec extends protocol.ProtocolSpecURL<infer TURLData>
? { url: protocol.RuntimeOf<TURLData> }
: {}) &
(TProtocolSpec extends protocol.ProtocolSpecQuery<infer TQuery>
? { query: protocol.RuntimeOf<TQuery> }
: {}) &
Expand Down
2 changes: 1 addition & 1 deletion endpoint-spec/src/implementation/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ function newBuilderGenericImpl<
? processMethodArg
: (pArgs) => {
const boundMethod = processMethodArg(pArgs) ?? pArgs.boundMethod;
return ({ context: _, ...args }) => boundMethod(args as any); // eslint-disable-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars
return (args) => boundMethod(data.omit(args, "context" as any) as any); // eslint-disable-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars
};
// Define resetMetadataProviders separately, as defining it inline causes problems with function overload having different argument count.
const resetMetadataProviders: api.ApplicationBuilderGeneric<
Expand Down

0 comments on commit b2fa9f6

Please sign in to comment.