Skip to content

Commit

Permalink
fix: simplify operation arg types
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerfaulkner committed Nov 8, 2023
1 parent c1cef52 commit 178da5b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@comake/standard-sdk-js",
"version": "2.2.5",
"version": "2.3.0",
"description": "An open source SDK to integrate and interact with any API",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
13 changes: 10 additions & 3 deletions src/openapi-types/OpenApiArgTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ type ArgsOfOperationInPathItemIfDefined<
export type OpenApiArgTypes<
T extends OpenApi,
TOperation extends string = string,
> = {
[key in keyof T['paths']]: ArgsOfOperationInPathItemIfDefined<T['paths'][key], TOperation, T>
}[keyof T['paths']];
TPathItemMatcher = {
[key in OpenApiOperationType]: Record<key, { operationId: TOperation }>
}[OpenApiOperationType],
TPathItem extends PathItem = Extract<
T['paths'][keyof T['paths']],
TPathItemMatcher
>,
> = [TPathItem] extends [never]
? never
: ArgsOfOperationInPathItemIfDefined<TPathItem, TOperation, T>;

0 comments on commit 178da5b

Please sign in to comment.